using CSharpDoc = DocumentFormat.OpenXml.Wordprocessing; var doc = new WordprocessingDocument(); var mainPart = doc.AddMainDocumentPart(); mainPart.Document = new CSharpDoc.Document();
var paragraph = mainPart.Document.Body.Elements().FirstOrDefault(p => p.InnerText == "My Paragraph"); if (paragraph != null) { var run = new CSharpDoc.Run(); run.AppendChild(new CSharpDoc.Text("Insert text here")); paragraph.AppendChild(run); }
using CSharpDoc = DocumentFormat.OpenXml.Spreadsheet; var doc = new SpreadsheetDocument(); var workbookPart = doc.AddWorkbookPart(); workbookPart.Workbook = new CSharpDoc.Workbook();
using CSharpDoc = DocumentFormat.OpenXml.Presentation; var doc = new PresentationDocument(); var presentationPart = doc.AddPresentationPart(); presentationPart.Presentation = new CSharpDoc.Presentation();Overall, C# Document is a powerful package library that allows developers to generate and manipulate various types of documents using C#. With its easy-to-use APIs, developers can customize the formatting and content of their documents with minimal effort.