We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add a table in a bookmark location?

Platform: WinForms |
Control: DocIO

 

DocIO provide the support for adding the table into the existing bookmark. The following code snippet illustrates how to insert the table into the specified bookmark.

C#

//Create a new instance for word document

WordDocumentdocument = new WordDocument();

//Open the existing word document containing bookmark

document.Open("Bookmark_Template.doc");

//Create a new table

IWTabletable = new WTable(document);

table.ResetCells(3, 2);

table.Rows[0].Cells[0].AddParagraph().AppendText("Sno");

table.Rows[0].Cells[1].AddParagraph().AppendText("Product");        

table.Rows[0].IsHeader = true;

table.Rows[1].Cells[0].AddParagraph().AppendText("1.");

table.Rows[1].Cells[1].AddParagraph().AppendText("Essential DocIO");        

table.Rows[2].Cells[0].AddParagraph().AppendText("2.");

table.Rows[2].Cells[1].AddParagraph().AppendText("Essential Pdf");

//Create a new instance for bookmark navigator

BookmarksNavigatorbk = new BookmarksNavigator(document);

//Move to the specified bookmark

bk.MoveToBookmark("Table");

//Insert the table into the specified bookmark location

bk.InsertTable(table);

document.Save("Sample.doc", FormatType.Doc);

 

VB

 

'Create a new instance for word document

Dimdocument As New WordDocument()

'Open the existing word document containing bookmark

document.Open("Bookmark_Template.doc")

'Create a new table

Dimtable As IWTable = New WTable(document)

table.ResetCells(3, 2)

table.Rows(0).Cells(0).AddParagraph().AppendText("Sno")

table.Rows(0).Cells(1).AddParagraph().AppendText("Product")

table.Rows(0).IsHeader = True

table.Rows(1).Cells(0).AddParagraph().AppendText("1.")

table.Rows(1).Cells(1).AddParagraph().AppendText("Essential DocIO")

table.Rows(2).Cells(0).AddParagraph().AppendText("2.")

table.Rows(2).Cells(1).AddParagraph().AppendText("Essential Pdf")

'Create a new instance for bookmark navigator

Dimbk As New BookmarksNavigator(document)

'Move to the specified bookmark

bk.MoveToBookmark("Table")

'Insert the table into the specified bookmark location

bk.InsertTable(table)

document.Save("Sample.doc", FormatType.Doc)

Please refer the sample in the below link which illustrates the above:

http://help.syncfusion.com/samples/DocIO.Web/DocIOWebSamples/AddTableToBkMark/main.htm

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile