Free Support Forum - aspose.com

Type Cell does not exists exception when TextSegment empty

Hello, we are using the XML data and XSLT templates to generate our pdf. However we came to a problem that when TextSegment element has empty value it resolves to



after XSLT transformation. When document containing this is put into the BindXml method it causes an exception

An unhandled exception of type ‘System.Exception’ occurred in Aspose.Pdf.dll
Additional information: Type Cell does not exists
at . (String )
at Aspose.Pdf.Cell. (XmlReader )
at Aspose.Pdf.Row. (XmlReader )
at Aspose.Pdf.Table.ctbyndf6krwz6e2pvkqhvayl56j9kkys (XmlReader )
at Aspose.Pdf.Page. (XmlReader )
at Aspose.Pdf.Document.BindXml(Stream stream)

When manually adding text to this element in XSLT template to resolve it to

addedsampletext


it works fine.

I would like to ask how can I work with empty cells (not all data has value in the source XML) without causing this exception.

Best Regards.

Hi Roman,


Thanks for contacting support.

I have tried to generate PDF from my sample XML and XSLT file(s) and was unable to notice the exception which you have mentioned. We will really appreciate if you please share sample input XML/XSLT file(s), with which you are facing issue. This way we can test the scenario in our environment and share our feedback appropriately.

We are sorry for the inconvenience.


Best Regards,

XSLT file:

<?xml version="1.0" encoding="utf-16"?>
<xsl:stylesheet version=“1.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” xmlns:msxsl=“urn:schemas-microsoft-com:xslt” exclude-result-prefixes=“msxsl”>
<xsl:output method=“xml” indent=“yes”/>
<xsl:template match="/ZmluvaZakazkaPonukaReportModel">
<xsl:value-of select="./Name1"/> č. <xsl:value-of select="./Id"/>
Some random header

1.1
test:
</xsl:template>
</xsl:stylesheet>

XML File:

<?xml version="1.0" encoding="utf-16"?>
testId
Kúpna zmluva

C# code
Thread.CurrentThread.CurrentCulture = new CultureInfo(“sk-SK”);
Aspose.Pdf.Document doc1 = new Document();
doc1.BindXml(“TestDataNullCell.xml”, @“TestAsposeNullCell.xslt”);

Hi Roman,


Thanks for sharing input XSLT/XML files. I have tested the scenario in our environment and managed to reproduce the issue. Though for the sake of correction, I have logged it as PDFNET-42685 in our issue tracking system. We will look into the details of the issue and keep you updated on the status of its rectification. Please be patient and spare us a little time.

We are sorry for the inconvenience.


Best Regards,