Free Support Forum - aspose.com

Cells to PDF issue with COUNTIF

I am converting an cells designer spreadsheet to PDF. The spreadsheet includes a COUNTIF formula that includes wildcards (i.e. =COUNTIF(A24:A35, “sometext”)

The result of the formula displays just fine in Excel, but when it is converted to PDF, the value displayed is always 0. A COUNTIF formula without wildcards (i.e. exact text match, =COUNTIF(A24:A35, “sometext”) works just fine, but I need to be able to use wildcards since the text I am counting might just be a small part of the whole text in the cell.

I even tried using several of the tips I’ve found in other forums, but the formula still does not show up correctly in the PDF.

CODE Sample:
Dim designer As WorkbookDesigner = New WorkbookDesigner
designer.Open(Server.MapPath(“designer_template_filename.xls”))
Dim ds As New DataSet
Dim dt As New DataTable(“PP”)

’ code to generate datatable removed

ds.Tables.Add(dt)
designer.SetDataSource(ds)
designer.Process()
designer.Workbook.CalculateFormula()
designer.Workbook.Worksheets(0).PageSetup.PaperSize = PaperSizeType.PaperLegal
designer.Workbook.Worksheets(0).PageSetup.Orientation = PageOrientationType.Landscape
Dim stream As New MemoryStream
designer.Workbook.Save(stream, FileFormatType.AsposePdf)

stream.Seek(0, SeekOrigin.Begin)
Dim xmlDoc As New XmlDocument
xmlDoc.Load(stream)

Dim p As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf
p.IsTruetypeFontMapCached = True
p.TruetypeFontMapPath = Path.GetTempPath()

p.BindXML(xmlDoc, Nothing)
p.Save(“filename.pdf”, Aspose.Pdf.SaveType.OpenInAcrobat, Response)

Hi,

Can you please save the intermediate xml to a file and send it to us along with the acctual xls and the generated pdf. We need these so that we can more accurately determine the cause of the problem. From the looks of it, the problem is pobably caused by Aspose.Cells because Aspsoe.Pdf doesn't calculate any formulas but just renders all values as received from Aspsoe.Cells through the xml.

Thanks.