This project has moved and is read-only. For the latest updates, please go here.

Copy formatting of a paragraph

Jan 29, 2014 at 1:03 PM
Hi,

I have a paragraph (a cell in a table) which has some formatting.
I need to replace the whole paragraph's content with a new text but to keep the same formatting.

Sometimes, the cell is empty but still has formatting like bold.

Can anyone explain how to do that?
Jan 29, 2014 at 8:05 PM
You can take a look at newest version (source code). Patch provided by Bartosz may allow it for you.
  • Fix for "Format matching in ReplaceText does not work properly"
  • New method: RemoveTextInGivenFormat
  • Added unit test: Test_Paragraph_ReplaceTextInGivenFormat
  • Added 'VariousTextFormatting.docx' file for unit testing purposes
  • Moved ContainsEveryChildOf method to HelperFunction becasue it is shared by Contaner and Paragraph
  • Added new feature in Container class: RemoveTextInGivenFormat
  • Added unit test: Test_Document_RemoveTextInGivenFormat
Jan 30, 2014 at 8:53 AM
I don't understand how removing a text by given format would help me insert text to an empty paragraph keeping the formatting.
Jan 30, 2014 at 8:58 AM
I wasn't referring to that. Fix for "Format matching in ReplaceText does not work properly" and you can take a look at Test_Paragraph_ReplaceTextInGivenFormat in UnitTests.