We process dozens of DOCX files into individual PDF and then assemble them into one big PDF. When we produce our draft document we like to show the user the changes to the document just like Word does with Track Changes on. Deleted text should show up red with strikethrough, and inserted text just shows up red.
I process all the documents through a DocumentVisitor because we remove portions of the document based on user selections in our application. I also use it to detect revisions in a run and apply the track changes formatting we desire since it seems to be stripped out when we convert to PDF.
if (draft && run.IsDeleteRevision)
{
run.Font.Color = REVISION_COLOR;
run.Font.StrikeThrough = true;
}
This works well EXCEPT for auto-numbered paragraphs and bulleted lists. In Word they show up red and if deleted will also show up with strikethrough.
How do I change the font of a bullet or auto-number to be red and optionally also strikethrough?
Thanks.
Hi
Thanks for your inquiry. To change formatting of the bullet you should change formatting of the paragraph end. Please see the following code for example:
// Open document
Document doc = new Document(@"Test001\in.doc");
// Change formating of the first paragraph end.
doc.FirstSection.Body.FirstParagraph.ParagraphBreakFont.Color = Color.Red;
doc.FirstSection.Body.FirstParagraph.ParagraphBreakFont.StrikeThrough = true;
// Save output document.
doc.Save(@"Test001\out.doc");
Hope this helps.
Best regards.
Thanks. That helped change the color, but setting StrikeThrough did not work.
Follow-on question:
Paragraph has properties IsDeletedRevision and IsInsertRevision. How does it determine this? Individual Runs within the paragraph may or may not be a revision. If I change the paragraph font properties as described, does it change all the paragraph’s runs?
Just to clarify, I only want to change color if the content is a revision, and only change the strikethrough property if it is a delete revision.
Thanks.
Heath
Hi
Thanks for you request.
- Strike through works fine on my side. I checked with bulleted list as well as with numbered list.
- If paragraph was deleted from the document Paragrpah.IsDeleteRevision will be true and if it was inserted Paragrpah.IsInsertRevision will be true. These properties are read from the original document.
- No, if you change only Paragraph.ParagraphBreakFont formating of the Runs inside the paragraph will not be changed.
Best regards.
Alexey,
Thanks for the response, but strikethrough still doesn’t work.
Here’s my paragraph end code:
public override VisitorAction VisitParagraphEnd(Paragraph paragraph)
{
if (paragraph.IsDeleteRevision)
{
paragraph.ParagraphBreakFont.Color = REVISION_COLOR;
paragraph.ParagraphBreakFont.StrikeThrough = true;
}
else if (paragraph.IsInsertRevision)
{
paragraph.ParagraphBreakFont.Color = REVISION_COLOR;
}
return base.VisitParagraphEnd(paragraph);
}
See page 17 of the attached DOCX file and page 16 of the PDF, starting with “a. The Telecommunications Equipment Room.”
All of the stuff between matching angle brackets (example: <BDE_ONLY>yadda, yadda</BDE_ONLY) are removable sections of the file. Depending on user selections in our app, the text between them will stay or go away. I also process them in the DocumentVisitor, but it’s all done in the VisitRun method. Nothing else is done in my VisitParagraphEnd method.
What am I missing?
Thanks again,
Heath
Hi
Thank you for additional information. I managed to reproduce the problem. It occurs only upon rendering. I will notify you as soon as the problem is resolved.
Best regards.
The issues you have found earlier (filed as WORDSNET-2745) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.