Deleting spesific text in word document without losing the format of the document

I need to delete some text in the word document (circled in red below), it seems to be a table in the document.

But I don’t want the bold words, line spacing and alignments to be gone. I need the final document to stay formatted as seen below. So, using datatable or string variable for deleting and then pasting the remaining text may change the format of the document, any ideas for doing the it without losing the word text format?

Thank you.

@Jenni_K Do you want to Delete the Table itself ?

Table can be deleted if it’s easier or all text inside it (Name 1, Name 2, Title 1, Title 2), doesn’t matter.

image

@Jenni_K Check this Workflow:
It needs DocumentFormat.OpenXml package to be installed.

First Check the Word File in the Input Folder. It Contains a Table. After Execution of the Workflow. The Table should be removed.

There may be errors when you open the Workflow. If Validation errors are found, just post the errors here else the Workflow should execute properly.
Delete Table In Word.zip (27.4 KB)

3 Likes

Hi,

Could you please send the screens maybe, couldn’t open the project you sent.

I tried to open it, but it got stucked at Restoring Dependencies… stage. I’m using 2019.10.0 version of studio. I don’t know what can be wrong?

@Jenni_K Ok. Then Try deleting the project.json File in the Project workflow which I have provided and then Open the Workflow again.

I somehow managed to open the project, no problem.

It seems you invoke some c# code and it worked pretty well, only if i had one table in my document. But i figured out that it’s the last table which i need to remove, so i altered your code to Last(); and outcome was successful.

Appreciate for the help!

1 Like

@Jenni_K Great ! :grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.