2

コンソールでファイルを作成する基本的なコードがあります(以下を参照)。しかし、MVCアプリを作成しているので、そのXMLドキュメントを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!!!!!")))));
        }
4

1 に答える 1