2
콘솔에 파일을 만드는 기본 코드가 있습니다 (아래 참조).하지만 ActionResult로 XML 문서를 반환해야하므로 MVC 앱을 작성하고 있습니다. 웹에서 2 시간 동안 찾고 있습니다. 운이없는 간단한 예제입니다.OPENXML Word 문서의 MVC ActionResult를 어떻게 반환합니까?
ActionResult가되기 위해 추가 할 내용은 무엇입니까?
string filePath = @"C:\temp\OpenXMLTest.docx";
using (WordprocessingDocument doc = WordprocessingDocument.Create(filePath, WordprocessingDocumentType.Document))
{
//// Creates the MainDocumentPart and add it to the document (doc)
MainDocumentPart mainPart = doc.AddMainDocumentPart();
mainPart.Document = new Document(
new Body(
new Paragraph(
new Run(
new Text("Hello World!!!!!")))));
}