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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Convert syntaxe from word to docio

Thread ID:

Created:

Updated:

Platform:

Replies:

143306 Mar 13,2019 10:52 AM UTC Mar 14,2019 03:00 PM UTC WinForms 1
loading
Tags: DocIO
AtliDev
Asked On March 13, 2019 10:52 AM UTC

hi,
1/ i have a document that contains two bookmark  "start" and "end" , iwant to delete the entity between the two bookmarks.
2/ how can i use backspace in docio
3/ can i convert this part of code from word9 to docio

wordObj.WorkDocument.Range(wordObj.WorkDocument.Bookmarks.Item("start").Start,wordObj.WorkDocument.Bookmarks.Item("end").End).Select()
wordObj.WorkDocument.ActiveWindow.Selection.Delete()
wordObj.WorkDocument.ActiveWindow.Selection.TypeBackspace()
wordObj.WorkDocument.ActiveWindow.Selection.MoveUp(Unit:=Word9.WdUnits.wdLine, Count:=1)
wordObj.WorkDocument.ActiveWindow.Selection.Tables.Item(1).Delete()
wordObj.WorkDocument.ActiveWindow.Selection.TypeBackspace()
wordObj.WorkDocument.ActiveWindow.Selection.TypeBackspace()
wordObj.WorkDocument.ActiveWindow.Selection.TypeBackspace()
wordObj.WorkDocument.ActiveWindow.Selection.TypeBackspace()

thanks

Dilli Babu Nandha Gopal [Syncfusion]
Replied On March 14, 2019 03:00 PM UTC

Hi AtliDev, 

Regarding want to delete the entity between the two bookmarks:
You can delete the bookmark contents in the Word document using BookmarksNavigator in DocIO. Please refer the below documentation link to know about deleting content from bookmark in Word document using DocIO:
https://help.syncfusion.com/file-formats/docio/working-with-bookmarks#deleting-content-from-a-bookmark

Regarding how can i use backspace in DocIO:
We suspect that your requirement is to remove some elements in the Word document. Essential DocIO is a non-UI component that provides a full-fledged document instance model similar to the Microsoft Office COM libraries to iterate with the document elements explicitly and perform necessary manipulation. To achieve your requirement we suggest you to iterate through the document elements and remove the element using DocIO.

If you face some difficulties to find and remove the particular the element in the Word document, you can also use find and replace functionality and replace with empty value.

Regarding can i convert this part of code from word9 to DocIO:
From the given code example, we suspect that your requirement to remove the bookmark contents and table in the Word document. You can iterate into the Word document and remove the elements using DocIO.

Please refer the below documentation links to know more about working with Word document using DocIO:
Iterating through document elements
Working with paragraph
 

Regards, 
Dilli babu. 


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.

Please sign in to access our forum

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

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

;