Free Support Forum - aspose.com

Write HTML paragraph buggy

Today I discovered a very ugly bug. Suppose I would like to render a HTML formated string like

test

to a pdf

the code
------------------------------------
string txt = “

test

”;
PText text1 = new PText(txt);
text1.IsHtmlTagSupported = true;
_section.Paragraphs.Add(text1);
-----------------------------------
should do the job, but it doesn’t

if I type
------------------------------------

string txt = “

test

”;

PText text1 = new PText(txt);

text1.IsHtmlTagSupported = true;

_section.Paragraphs.Add(text1);


text1 = new PText(txt);
text1.IsHtmlTagSupported = true;
_section.Paragraphs.Add(text1);


-----------------------------------
instead, it works, as if you need a second instance of the same string to render it as HTML- block into your document
We use actually Version 7.4

Hi Pascal,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the details.

However, I tried your scenario and I am unable to notice any problem / issue in the generated PDF file using Aspose.Pdf for .NET v7.4. Please share the completed sample code and your generated PDF files to show / explain the issue. This will help us in understanding and identifying the issue soon.

Sorry for the inconvenience,

Dear Aspose team,

attached you will find the vs solution that permits to reproduce the recently
posted “toc level>3” and “html buggy” errors.
Please contact me if there are further questions

Best regards
Kagel

Hi Kagel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the sample application.

However, your application does not have any test case for buggy HTML issue you have mentioned in your previous post. There are 2 over loaded methods “AddParaGraphToSection” but they are not called from any of your test cases. Please provide some more information regarding how to execute the test case for buggy HTML.

Regarding TOC issue, it is already been registered against your separate thread here.

Sorry for the inconvenience,

Hi Nausherwan,

the two methods AddParaGraphToSection() are not used

since they have been implemented to added

any non html formatted string to a section.

The current problem can be reduced to:

++++++++++++++++++++++++

Text txt = new Text(anyhtmltext);

txt.IsHtmlTagSupported = true;

_section.Paragraphs.Add(txt);

++++++++++++++++++++++++++++++

>>> adds nothing to the section, whereas

++++++++++++++++++++++++

Text txt = new Text(anyhtmltext);

txt.IsHtmlTagSupported = true;

_section.Paragraphs.Add(txt);

txt.IsHtmlTagSupported = true;

_section.Paragraphs.Add(txt);

++++++++++++++++++++++++++++++

>>> add the anyhtmltext once although it should appear twice ?

Any idea?

Best reagrds

Kagel

Hi Kagel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, it is a very strange issue because (as I mentioned before), I am unable to reproduce the problem at my end. Please provide us the details regarding your system environment i.e. OS, .NET Framework, 32 bit / 64 bit machine etc. and create a sample application with just your problematic code and share with us. We will check it and get back to you soon.

Sorry for the inconvenience,

Hi Nausherwan,

we use .net 4, on a Win7 64 bit machine see details in the attached screen.

The problem should be easily reproducible if you start the app I sent you already and

comment the section as follows:

1 Text txt = new Text(anyhtmltext);

2 txt.IsHtmlTagSupported = true;

3 _section.Paragraphs.Add(txt);

4 //txt.IsHtmlTagSupported = true;

5 //_section.Paragraphs.Add(txt);

Like this the paragraph, won't be witten in the output pdf.

Uncommen tline 4 and 5 then it will appear.

Best regards

Kagel

Hi Kagel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the details

I am able to reproduce your mentioned issue after an initial test using your sample application. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34476. We will notify you via this forum thread regarding any updates.

Sorry for the inconvenience,