How to extract text from word without loosing the format, line breaks and spacing and copy into another word document

Hi,

I have a word document where i i need to extract certain bullet points when it starts with a certain word. Say for eg: if a line starts with [Text], then I need to extract that entire bullet point.

I am ableto extract the bullet point, but unable to save the format and spacing. How can I achive that? The format, spacing and line endings should match with the original document

1 Like

To extract bullet points from a Word document in UiPath while preserving the original formatting, spacing, and line endings, you need to work with the document’s structure rather than just plain text extraction.
The standard “Read Text” activity in UiPath returns only the text content and loses formatting, bullet styles, and indentation.
Please try this approach

Use “Export to PDF” and Extract from PDF

  • Convert the Word document to PDF using UiPath’s “Export to PDF” activity
  • Use UiPath’s PDF activities to extract the required bullet points. PDF extraction often retains more layout and formatting than plain text from Word

2 Likes

@AnjibabuSeesala

Thank you.. One more thing is that I need to save it to word at the end. How do i do that after extracting from pdf?

1 Like

Hi @Krithi1

here you go

Write Text to Word Document**
→ Use the Word Application Scope** activity (from the UiPath.Word.Activities package).
→ Specify the Word file path where you want to save the text. If the file doesn’t exist, it will be created automatically.
→ Inside the scope, use the Append Text activity to write the extracted text (pdfText) into the Word document. This activity preserves line breaks and spacing from your string.

hope this helps !!

1 Like

@AnjibabuSeesala

I dont see extract text from PDF activity, but i used Read PDF text and then split function to extract data. Is that ok?

1 Like

I tried this and it puts half of the text to next line and thus formatting is changung.
Any other step I may be missing?

1 Like