public static void Run() { // ExStart:AddTextNodeWithTag // ExFor:NoteTagCore // ExFor:NoteTagCore.Icon // ExFor:NoteTag // ExFor:RichText // ExFor:RichText.Text // ExFor:RichText.ParagraphStyle // ExSummary:Shows how to add new paragraph with tag. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize Outline class object Outline outline = new Outline(doc); // Initialize OutlineElement class object OutlineElement outlineElem = new OutlineElement(doc); ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; RichText text = new RichText(doc) { Text = "OneNote text.", ParagraphStyle = textStyle }; text.Tags.Add(new NoteTag { Icon = TagIcon.YellowStar, }); // Add text node outlineElem.AppendChildLast(text); // Add outline element node outline.AppendChildLast(outlineElem); // Add outline node page.AppendChildLast(outline); // Add page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "AddTextNodeWithTag_out.one"; doc.Save(dataDir); // ExEnd:AddTextNodeWithTag Console.WriteLine("\nText node with tag added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AddImageNodeWithTag // ExFor:Image // ExFor:Image.Tags // ExFor:NoteTagCore // ExFor:NoteTagCore.Icon // ExFor:NoteTag // ExFor:Page // ExFor:Outline // ExFor:OutlineElement // ExSummary:Shows how to add new image with tag. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize Outline class object Outline outline = new Outline(doc); // Initialize OutlineElement class object OutlineElement outlineElem = new OutlineElement(doc); // Load an image Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "icon.jpg"); // Insert image in the document node outlineElem.AppendChildLast(image); image.Tags.Add(new NoteTag { Icon = TagIcon.YellowStar, }); // Add outline element node outline.AppendChildLast(outlineElem); // Add outline node page.AppendChildLast(outline); // Add page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "AddImageNodeWithTag_out.one"; doc.Save(dataDir); // ExEnd:AddImageNodeWithTag Console.WriteLine("\nImage node with tag added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:BuildDocAndInsertImage // ExFor:Document // ExFor:Image // ExFor:Image.Alignment // ExSummary:Shows how to add an image from file to a document. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize Outline class object and set offset properties Outline outline = new Outline(doc); // Initialize OutlineElement class object OutlineElement outlineElem = new OutlineElement(doc); // Load an image by the file path. Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg") { // Set image alignment Alignment = HorizontalAlignment.Right }; // Add image outlineElem.AppendChildLast(image); // Add outline elements outline.AppendChildLast(outlineElem); // Add Outline node page.AppendChildLast(outline); // Add Page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "BuildDocAndInsertImage_out.one"; doc.Save(dataDir); // ExEnd:BuildDocAndInsertImage Console.WriteLine("\nDocument created and image inserted successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AttachFileAndSetIcon // ExFor:Document // ExFor:AttachedFile // ExSummary:Shows how to add a file from a stream to a document. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Attachments(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize Outline class object Outline outline = new Outline(doc); // Initialize OutlineElement class object OutlineElement outlineElem = new OutlineElement(doc); using (var stream = File.OpenRead(dataDir + "icon.jpg")) { // Initialize AttachedFile class object and also pass its icon path AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt", stream, ImageFormat.Jpeg); // Add attached file outlineElem.AppendChildLast(attachedFile); } // Add outline element node outline.AppendChildLast(outlineElem); // Add outline node page.AppendChildLast(outline); // Add page node doc.AppendChildLast(page); dataDir = dataDir + "AttachFileAndSetIcon_out.one"; doc.Save(dataDir); // ExEnd:AttachFileAndSetIcon Console.WriteLine("\nFile attached and it's icon setup successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:BuildDocAndInsertImageUsingImageStream // ExFor:Document // ExFor:Image // ExFor:Image.Alignment // ExSummary:Shows how to add an image from stream to a document. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); Outline outline1 = new Outline(doc); OutlineElement outlineElem1 = new OutlineElement(doc); using (FileStream fs = File.OpenRead(dataDir + "image.jpg")) { // Load the second image using the image name, extension and stream. Aspose.Note.Image image1 = new Aspose.Note.Image(doc, "Penguins.jpg", fs) { // Set image alignment Alignment = HorizontalAlignment.Right }; outlineElem1.AppendChildLast(image1); } outline1.AppendChildLast(outlineElem1); page.AppendChildLast(outline1); doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "BuildDocAndInsertImageUsingImageStream_out.one"; doc.Save(dataDir); // ExEnd:BuildDocAndInsertImageUsingImageStream Console.WriteLine("\nDocument created and image using image stream inserted successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AttachFileByPath // ExFor:Document // ExFor:AttachedFile // ExSummary:Shows how to add a file to a document by using filepath. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Attachments(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize Outline class object Outline outline = new Outline(doc); // Initialize OutlineElement class object OutlineElement outlineElem = new OutlineElement(doc); // Initialize AttachedFile class object AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt"); // Add attached file outlineElem.AppendChildLast(attachedFile); // Add outline element node outline.AppendChildLast(outlineElem); // Add outline node page.AppendChildLast(outline); // Add page node doc.AppendChildLast(page); dataDir = dataDir + "AttachFileByPath_out.one"; doc.Save(dataDir); // ExEnd:AttachFileByPath Console.WriteLine("\nFile by path attached successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:InsertImage // ExFor:Document // ExFor:Image // ExFor:Image.Width // ExFor:Image.Height // ExFor:Image.HorizontalOffset // ExFor:Image.VerticalOffset // ExFor:Image.Alignment // ExSummary:Shows how to add an image from file to a document with user defined properties. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Images(); // Load document from the stream. Document doc = new Document(dataDir + "Aspose.one"); // Get the first page of the document. Aspose.Note.Page page = doc.FirstChild; // Load an image from the file. Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg") { // Change the image's size according to your needs (optional). Width = 100, Height = 100, // Set the image's location in the page (optional). HorizontalOffset = 100, VerticalOffset = 400, // Set image alignment Alignment = HorizontalAlignment.Right }; // Add the image to the page. page.AppendChildLast(image); // ExEnd:InsertImage Console.WriteLine("\nImage inserted successfully to OneNote document."); }
public static void Run() { // ExStart:ApplyNumberingOnText // ExFor:NumberList // ExFor:ParagraphStyle // ExFor:ParagraphStyle.FontColor // ExFor:ParagraphStyle.FontName // ExFor:ParagraphStyle.FontSize // ExFor:Page // ExFor:Outline // ExFor:OutlineElement // ExFor:OutlineElement.NumberList // ExFor:RichText // ExFor:RichText.ParagraphStyle // ExFor:RichText.Text // ExSummary:Shows how to insert new list with numbering. string dataDir = RunExamples.GetDataDir_Text(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize Outline class object Outline outline = new Outline(doc); // Initialize TextStyle class object and set formatting properties ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; // Initialize OutlineElement class objects and apply numbering // Numbers in the same outline are automatically incremented. OutlineElement outlineElem1 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) }; RichText text1 = new RichText(doc) { Text = "First", ParagraphStyle = defaultStyle }; outlineElem1.AppendChildLast(text1); OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) }; RichText text2 = new RichText(doc) { Text = "Second", ParagraphStyle = defaultStyle }; outlineElem2.AppendChildLast(text2); OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) }; RichText text3 = new RichText(doc) { Text = "Third", ParagraphStyle = defaultStyle }; outlineElem3.AppendChildLast(text3); // Add outline elements outline.AppendChildLast(outlineElem1); outline.AppendChildLast(outlineElem2); outline.AppendChildLast(outlineElem3); // Add Outline node page.AppendChildLast(outline); // Add Page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "ApplyNumberingOnText_out.one"; doc.Save(dataDir); // ExEnd:ApplyNumberingOnText Console.WriteLine("\nNumbering applied successfully on a text.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:CreateDocWithFormattedRichText // ExFor:ImageSaveOptions.PageIndex // ExSummary:Shows how to create a document with formatted rich text. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadingAndSaving(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize Title class object Title title = new Title(doc); // Initialize TextStyle class object and set formatting properties ParagraphStyle defaultTextStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; RichText titleText = new RichText(doc) { Text = "Title!", ParagraphStyle = defaultTextStyle }; Outline outline = new Outline(doc) { VerticalOffset = 100, HorizontalOffset = 100 }; OutlineElement outlineElem = new OutlineElement(doc); // RunIndex = 5 means the style will be applied only to 0-4 characters. ("Hello") TextStyle textStyleForHelloWord = new TextStyle { FontColor = Color.Red, FontName = "Arial", FontSize = 10, RunIndex = 5, }; // RunIndex = 13 means the style will be applied only to 5-12 characters. (" OneNote") TextStyle textStyleForOneNoteWord = new TextStyle { FontColor = Color.Green, FontName = "Calibri", FontSize = 10, IsItalic = true, RunIndex = 13, }; // RunIndex = 18 means the style will be applied only to 13-17 characters. (" text"). // Other characters ("!") will have the default style. TextStyle textStyleForTextWord = new TextStyle { FontColor = Color.Blue, FontName = "Arial", FontSize = 15, IsBold = true, IsItalic = true, RunIndex = 18, }; RichText text = new RichText(doc) { Text = "Hello OneNote text!", ParagraphStyle = defaultTextStyle, Styles = { textStyleForHelloWord, textStyleForOneNoteWord, textStyleForTextWord } }; title.TitleText = titleText; // Set page title page.Title = title; // Add RichText node outlineElem.AppendChildLast(text); // Add OutlineElement node outline.AppendChildLast(outlineElem); // Add Outline node page.AppendChildLast(outline); // Add Page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "CreateDocWithFormattedRichText_out.one"; doc.Save(dataDir); // ExEnd:CreateDocWithFormattedRichText Console.WriteLine("\nOneNote document created successfully with formatted rich text.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:CreateTableWithLockedColumns // ExFor:Table // ExFor:Table.Columns // ExFor:Table.IsBordersVisible // ExFor:TableColumn // ExFor:TableColumn.Width // ExFor:TableColumn.LockedWidth // ExFor:TableRow // ExFor:TableCell // ExSummary:Shows how to create a table with a locked column. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tables(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize TableRow class object TableRow row1 = new TableRow(doc); // Initialize TableCell class object and set text content TableCell cell11 = new TableCell(doc); cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text")); row1.AppendChildLast(cell11); // Initialize TableRow class object TableRow row2 = new TableRow(doc); // Initialize TableCell class object and set text content TableCell cell21 = new TableCell(doc); cell21.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Long text with several words and spaces.")); row2.AppendChildLast(cell21); // Initialize Table class object Table table = new Table(doc) { IsBordersVisible = true, Columns = { new TableColumn { Width = 70, LockedWidth = true } } }; // Add rows table.AppendChildLast(row1); table.AppendChildLast(row2); Outline outline = new Outline(doc); OutlineElement outlineElem = new OutlineElement(doc); // Add table node outlineElem.AppendChildLast(table); // Add outline element node outline.AppendChildLast(outlineElem); // Add outline node page.AppendChildLast(outline); // Add page node doc.AppendChildLast(page); dataDir = dataDir + "CreateTableWithLockedColumns_out.one"; doc.Save(dataDir); // ExEnd:CreateTableWithLockedColumns Console.WriteLine("\nTable with locked columns created successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:InsertChineseNumberList // ExFor:NumberList // ExFor:ParagraphStyle // ExFor:ParagraphStyle.FontColor // ExFor:ParagraphStyle.FontName // ExFor:ParagraphStyle.FontSize // ExFor:Page // ExFor:Outline // ExFor:OutlineElement // ExFor:OutlineElement.NumberList // ExFor:RichText // ExFor:RichText.ParagraphStyle // ExFor:RichText.Text // ExSummary:Shows how to insert new list with chinese numbering. string dataDir = RunExamples.GetDataDir_Text(); // Initialize OneNote document Aspose.Note.Document doc = new Aspose.Note.Document(); // Initialize OneNote page Aspose.Note.Page page = new Aspose.Note.Page(doc); Outline outline = new Outline(doc); // Apply text style settings ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; // Numbers in the same outline are automatically incremented. OutlineElement outlineElem1 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) }; RichText text1 = new RichText(doc) { Text = "First", ParagraphStyle = defaultStyle }; outlineElem1.AppendChildLast(text1); //------------------------ OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) }; RichText text2 = new RichText(doc) { Text = "Second", ParagraphStyle = defaultStyle }; outlineElem2.AppendChildLast(text2); //------------------------ OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) }; RichText text3 = new RichText(doc) { Text = "Third", ParagraphStyle = defaultStyle }; outlineElem3.AppendChildLast(text3); //------------------------ outline.AppendChildLast(outlineElem1); outline.AppendChildLast(outlineElem2); outline.AppendChildLast(outlineElem3); page.AppendChildLast(outline); doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "InsertChineseNumberList_out.one"; doc.Save(dataDir); // ExEnd:InsertChineseNumberList Console.WriteLine("\nChinese number list inserted successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:CreateDocWithRootAndSubPages // ExFor:Page // ExFor:Page.Level // ExSummary:Shows how to add a page with a subpage. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Pages(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object and set its level Aspose.Note.Page page1 = new Aspose.Note.Page(doc) { Level = 1 }; // Initialize Page class object and set its level Aspose.Note.Page page2 = new Aspose.Note.Page(doc) { Level = 2 }; // Initialize Page class object and set its level Aspose.Note.Page page3 = new Aspose.Note.Page(doc) { Level = 1 }; /*---------- Adding nodes to first Page ----------*/ Outline outline = new Outline(doc); OutlineElement outlineElem = new OutlineElement(doc); ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; RichText text = new RichText(doc) { Text = "First page.", ParagraphStyle = textStyle }; outlineElem.AppendChildLast(text); outline.AppendChildLast(outlineElem); page1.AppendChildLast(outline); /*---------- Adding nodes to second Page ----------*/ var outline2 = new Outline(doc); var outlineElem2 = new OutlineElement(doc); var textStyle2 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; var text2 = new RichText(doc) { Text = "Second page.", ParagraphStyle = textStyle2 }; outlineElem2.AppendChildLast(text2); outline2.AppendChildLast(outlineElem2); page2.AppendChildLast(outline2); /*---------- Adding nodes to third Page ----------*/ var outline3 = new Outline(doc); var outlineElem3 = new OutlineElement(doc); var textStyle3 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; var text3 = new RichText(doc) { Text = "Third page.", ParagraphStyle = textStyle3 }; outlineElem3.AppendChildLast(text3); outline3.AppendChildLast(outlineElem3); page3.AppendChildLast(outline3); /*---------- Add pages to the OneNote Document ----------*/ doc.AppendChildLast(page1); doc.AppendChildLast(page2); doc.AppendChildLast(page3); // Save OneNote document dataDir = dataDir + "CreateDocWithRootAndSubPages_out.one"; doc.Save(dataDir); // ExEnd:CreateDocWithRootAndSubPages Console.WriteLine("\nOneNote document created successfully with root and sub level pages.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AddHyperlink // ExFor:Document // ExFor:RichText // ExFor:RichText.ParagraphStyle // ExFor:RichText.Styles // ExFor:RichText.Text // ExFor:TextStyle // ExFor:TextStyle.FontColor // ExFor:TextStyle.FontName // ExFor:TextStyle.FontSize // ExFor:TextStyle.RunIndex // ExFor:TextStyle.IsHyperlink // ExFor:TextStyle.HyperlinkAddress // ExSummary:Shows how to bind a hyperlink to a text. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tasks(); // Create an object of the Document class Document doc = new Document(); RichText titleText = new RichText(doc) { Text = "Title!", ParagraphStyle = ParagraphStyle.Default }; Outline outline = new Outline(doc) { MaxWidth = 200, MaxHeight = 200, VerticalOffset = 100, HorizontalOffset = 100 }; TextStyle textStyleRed = new TextStyle { FontColor = Color.Red, FontName = "Arial", FontSize = 10, // This style will be applied to 0-7 characters. RunIndex = 8 }; TextStyle textStyleHyperlink = new TextStyle { // This style will be applied to 8-16 characters. RunIndex = 17, IsHyperlink = true, HyperlinkAddress = "www.google.com" }; RichText text = new RichText(doc) { Text = "This is hyperlink. This text is not a hyperlink.", ParagraphStyle = ParagraphStyle.Default, Styles = { textStyleRed, textStyleHyperlink } }; OutlineElement outlineElem = new OutlineElement(doc); outlineElem.AppendChildLast(text); // Add outline elements outline.AppendChildLast(outlineElem); // Initialize Title class object Title title = new Title(doc) { TitleText = titleText }; // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc) { Title = title }; // Add Outline node page.AppendChildLast(outline); // Add Page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "AddHyperlink_out.one"; doc.Save(dataDir); // ExEnd:AddHyperlink Console.WriteLine("\nHyperlink added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AddTableNodeWithTag // ExFor:Table // ExFor:Table.Columns // ExFor:Table.IsBordersVisible // ExFor:TableColumn // ExFor:TableColumn.Width // ExFor:TableRow // ExFor:TableCell // ExFor:NoteTag // ExSummary:Shows how to add new table with tag. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize TableRow class object TableRow row = new TableRow(doc); // Initialize TableCell class object TableCell cell = new TableCell(doc); // Insert cell content cell.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Single cell.")); // Add cell to row node row.AppendChildLast(cell); // Initialize table node Table table = new Table(doc) { IsBordersVisible = true, Columns = { new TableColumn { Width = 70 } } }; // Insert row node in table table.AppendChildLast(row); // Add tag to this table node table.Tags.Add(NoteTag.CreateQuestionMark()); Outline outline = new Outline(doc); OutlineElement outlineElem = new OutlineElement(doc); // Add table node outlineElem.AppendChildLast(table); // Add outline elements outline.AppendChildLast(outlineElem); page.AppendChildLast(outline); doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "AddTableNodeWithTag_out.one"; doc.Save(dataDir); // ExEnd:AddTableNodeWithTag Console.WriteLine("\nTable node with tag added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:InsertTable // ExFor:Table // ExFor:Table.Columns // ExFor:Table.IsBordersVisible // ExFor:TableColumn // ExFor:TableColumn.Width // ExFor:TableRow // ExFor:TableCell // ExSummary:Shows how to create a new table. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tables(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize TableRow class object TableRow row1 = new TableRow(doc); // Initialize TableCell class objects TableCell cell11 = new TableCell(doc); TableCell cell12 = new TableCell(doc); TableCell cell13 = new TableCell(doc); // Append outline elements in the table cell cell11.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.1")); cell12.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.2")); cell13.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.3")); // Table cells to rows row1.AppendChildLast(cell11); row1.AppendChildLast(cell12); row1.AppendChildLast(cell13); // Initialize TableRow class object TableRow row2 = new TableRow(doc); // initialize TableCell class objects TableCell cell21 = new TableCell(doc); TableCell cell22 = new TableCell(doc); TableCell cell23 = new TableCell(doc); // Append outline elements in the table cell cell21.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.1")); cell22.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.2")); cell23.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.3")); // Append table cells to rows row2.AppendChildLast(cell21); row2.AppendChildLast(cell22); row2.AppendChildLast(cell23); // Initialize Table class object and set column widths Table table = new Table(doc) { IsBordersVisible = true, Columns = { new TableColumn { Width = 200 }, new TableColumn { Width = 200 }, new TableColumn { Width = 200 } } }; // Append table rows to table table.AppendChildLast(row1); table.AppendChildLast(row2); // Initialize Outline object Outline outline = new Outline(doc); // Initialize OutlineElement object OutlineElement outlineElem = new OutlineElement(doc); // Add table to outline element node outlineElem.AppendChildLast(table); // Add outline element to outline outline.AppendChildLast(outlineElem); // Add outline to page node page.AppendChildLast(outline); // Add page to document node doc.AppendChildLast(page); dataDir = dataDir + "InsertTable_out.one"; doc.Save(dataDir); // ExEnd:InsertTable Console.WriteLine("\nTable inserted successfully.\nFile saved at " + dataDir); }