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.
Unfortunately, activation email could not send to your email. Please try again.

How to add a table in a bookmark location?

 

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

Article ID: Published Date: Last Revised Date: Platform: Control:
279 04/30/2011 07/10/2014 Windows Forms DocIO
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.