Free Support Forum - aspose.com

Problem with bold/underline

Okay,

I have copied a chunck of text of one of our 1800 words files on our server in the attached word file (SampleUnderline.doc). I convert the document to PDF (SampleUnderline.doc.pdf) with Aspose.words/aspose.pdf.

The output has some little dash due to bold/underline "empty" style... How do I fix this glitch ?

Thank you !

Hello!
Thank you for asking this.
Underlined elements in empty lines are the matter of issue #3228. It is already fixed in the current codebase. The update will be available with the next hotfix.
As a workaround you can remove Underline attribute from places where it is unneeded, namely from empty paragraphs.
Regards,

Cool. thank you,

Do you know when the next hotfix will be released ? or... How do i remove those empty underline elements ? Im new to aspose.words.

Thank you !

Hi

Try to use the following code to convert your document to PDF.

string path = @"E:\Projects\Aspos.words\Tests\SampleUnderline.doc";

Document doc = new Document(path);

NodeCollection paragraps = doc.GetChildNodes(NodeType.Paragraph, true);

foreach (Paragraph par in paragraps)

{

if ((par.Runs.Count <= 0))

{

par.ParagraphBreakFont.Underline = Underline.None;

}

}

doc.Save(Path.ChangeExtension(path, "xml"), SaveFormat.AsposePdf);

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

pdf.BindXML(Path.ChangeExtension(path, "xml"), null);

pdf.IsImagesInXmlDeleteNeeded = false;

pdf.Save(Path.ChangeExtension(path, "pdf"));

Best regards