We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Table rows/cell values disappearing when converting to PDF

Can you please take a look at the attached set of documents and
figure out why the first row in the second table disappears when
converting to PDF, and also why the values in the second row of the
same table have disappeared?

This is the code that processes the generated document prior to export:

NodeCollection runs = document.GetChildNodes(NodeType.Run, true);
Regex arabicMatchExpr = new Regex(@"\p{IsArabic}+");
foreach (Run run in runs)
{
Match arabicMatch = arabicMatchExpr.Match(run.Text);
if (arabicMatch.Success)
{
run.Font.Bidi = true;
}
else
{
Match dateMatch = dateExpr.Match(run.Text);
if (dateMatch.Success)
{
run.Font.Bidi = true;
run.Text = DateTime.Parse(run.Text).ToString(“dd/MM/yyyy”);
}
}
}
MemoryStream tempStream = new MemoryStream();
document.Save(tempStream, SaveFormat.AsposePdf);
Pdf pdfDoc = new Pdf();
pdfDoc.BindXML(tempStream, null);
pdfDoc.IsRightToLeft = true;

pdfDoc.Save(String.Format("{0}_{1:yyyyMMddHHmmss}.pdf", docType,
DateTime.Now), Aspose.Pdf.SaveType.OpenInAcrobat, httpResponse);
httpResponse.End();

Thanks,
Larkin

Hi Larkin,

I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFNET-7152. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I really need a fix for this as soon as possible. I did some debugging research and what I came up with is this:

The generated XML has a number of the text segments within the table cells enclosed in elements. I don’t know why this is done–perhaps this is how Word treats text runs within table cells, but in any case it is fine IF the text runs within the heading element are LTR. If the text runs are RTL (or perhaps it is the Unicode flag that causes the problem) then the cell renders as empty. As you see in the documents I attached in my previous post, the entire first row of the second table is not missing, it has merely collapsed because all its cells are empty since the values of every cell are Arabic characters.

To verify that this is the problem, generate the XML file from the test2.doc file and locate the following line:


الحوض


Change the element to a element, as shown below:


الحوض


Now call BindXml() using this modified XML file and you will see that in the resulting PDF the row now appears, and the value in the segment above displays correctly.


So now that I’ve done your leg work for you, can you fix the bug for me?? :wink: :wink: :wink:

Hi Larkin,

Thank you very much for your help; the findings will help us resolve the issue. We'll let you know about the estimated time of the fix, as we get some information from our development team.

We appreciate your patience.

Regards,

Dear Larkin,

We appreciate for your help. I have confirmed that your investigation on the issue is right. I think the bug would be fixed in about one week. We will try our best to make it sooner and send you an update once the fix is ready.

Best regards.