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.

Adding tables at a bookmark location

Thread ID:

Created:

Updated:

Platform:

Replies:

69016 Oct 10,2007 04:33 AM Oct 17,2007 09:31 AM Windows Forms 1
loading
Tags: DocIO
Jason Finch
Asked On October 10, 2007 04:33 AM

Does anyone have an example of how to add a table at a bookmark. I had working code in v4.2 and have since recently upgraded.

Now I am have difficulties correcting the code.

Old code was:
IWTable table = (WTable) bookmark.InsertParagraphItem(ParagraphItemType.Table);
BuildTable(table);

The problems I see:
The enum ParagraphItemType.Table no longer appears in the current build.

bookmark.GetBookmarkContent() brings back a TextBodyPart. I am unsure if I can add tables to this object.

Any starting tips?

Thanks,
Jason





Melba Winshia [Syncfusion]
Replied On October 17, 2007 09:31 AM

Hi Jason,

We regret for the delayed response.

You can add a table at a bookmark location by getting the table in the TextBodyPart and replacing the bookmark by using this TextBodyPart.

[C#]

BookmarksNavigator bn = new BookmarksNavigator(doc);

//Select a table
TextBodyPart bodyPart = new TextBodyPart(replaceDoc);
bodyPart.BodyItems.Add(replaceDoc.LastSection.Body.Tables[0] as WTable);

//bn.DeleteBookmarkContent2();
bn.MoveToBookmark("bkmk_target");

//Replace with table
bn.ReplaceBookmarkContent(bodyPart);

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

http://websamples.syncfusion.com/samples/DocIO.Windows/69016/main.htm

Please try this and let me know if this helps.

Thanks,
Melba


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;