Free Support Forum - aspose.com

WorkbookDesigner export to PDF issue

I’m having an issue with the new version of Cells (4.5.0.0) that did not occur in the 4.4.3.1 version I was using. As part of the export process, an artifact (see attached image) is being added to the XML that is not created anywhere that I can tell. The exact same artifact is appearing on many of the reports (25 out of 31) my application creates, though not all (for reasons I can not figure out yet). I know it is being created by Cells as I have examined the XML created by the save process when saving to PDF format. The XML being created is:


Collateral
#$NLABA
-All assets#$NL
AR -
Accts Receivable#$NL
IN
- Inventory#$NL
EQ
- Equipment#$NL
RE
- Real Estate#$NL
ST
- Stock#$NL
UN
- Unsecured#$NL
DE
- Deposits






There is nothing even related to this in the designer template file. The template file is a single row of smartmarkers with a summary row below it and a column title row above it. There is also nothing in the database data related to this.

The VB.NET code used to create the workbook designer is:
Dim revID As Integer = MySession.ReviewID
Dim designer As WorkbookDesigner = New WorkbookDesigner
designer.Open(Server.MapPath("…/Templates/NewBorrowerCI.xls"))
Dim ds As New DataSet
Dim rr As New RICReports
Dim dt As New DataTable(“PP”)
dt.Merge(rr.GetNewBorrowerReport(revID))
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
Return designer

The only variation from report to report is the function used in dt.Merge to get the data from the database and template file opened in the designer.open code. The code for the conversion is:
Dim designer As WorkbookDesigner = Nothing
designer = Me.GenerateExcelDesigner() /// Calls the above code to generate the designer
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)

I cannot figure out where the artifact is coming from. As I said, it is the exact same in every report where it shows up and it did not occur in the previous version of Cells (4.4.3.1), only in the new version (4.5.0.0).

Hi,

That looks strange, Could you post your template excel file, so that we may check your file and implement the conversion (xls2pdf) to reproduce the issue you have mentioned.

Thank you.

Hi,

Please try this fix.

We have fixed the bug of position of the text box.

Here is one of the sample template files I use. But as I said, this happens across many different template files.

The updated DLL file did not make the artifact disappear. It still appears in the top left corner and the floatingbox XML is still being generated.

Hi,

Thanks for your feedback,

We will check it soon.

Thank you.

Thanks. In the meantime I have added a quick function to my code for the reports that calls the following sub to strip out any FloatingBox elements in the paragraphs. It appears to work for the moment.

Public Sub StripFloatingBox(ByRef s As Aspose.Pdf.Section)
Dim paras As New Aspose.Pdf.Paragraphs
For Each p As Paragraph In s.Paragraphs
If Not p.GetType.Name = "FloatingBox" Then
paras.Add(p)
End If
Next
s.Paragraphs = paras
End Sub

Hi,

Please try this fix.

After checking the xml file, we find Floating box will auto expand although we set the width and height is zero.We have removed it in the xml file if the width and height is zero.

This does appear to address the issue.