After exporting Xls reports to Pdf format I got all the "multiline" cells in the spreadsheet flattened.
For example, a document like this:
-----------
text text |
-----------
line1 |
line2 |
-----------
After exporting in pdf
text text
line1 ?line2
I suppose that during the pdf exporting all the CRLF are misinterpreted as invalid characters (they are shown as squares in the actual pdf file).
Here is the code I use for generating the pdf:
UnicodeString pathpdf;
TXlsFile* xls = new TXlsFile("abc.xls", true);
try
{
TFlexCelPdfExport* pdf = new TFlexCelPdfExport(xls, true);
try
{
pdf->FontEmbed = TFontEmbed::None;
pdf->FontMapping = TFontMapping::ReplaceAllFonts;
pathpdf = "abc.pdf";
pdf->Export(pathpdf);
}
__finally
{
delete pdf;
}
}
__finally
{
delete xls;
}
return pathpdf;
Hi,
I was using Apache OpenOffice to show the file (I have Excel 2003 installed on another computer). In OO the file was fine, so I was fooled.
Wrapping the text did the trick! PDF are fine! Thank you.
But now that I open the xls I see squares so have another problem.
You say that FlexCel reports convert automatically CRLF to LF, so why my report still have CRs?
The text is generated from a User Defined Function:
<#GetText(MemoComment)>
GetText reads the text (UnicodeString with CRLFs), converts it to a Variant, calls the TCellValue constructor and then casts it to ReportValue... may be some type information is lost during this process? I can paste the full source but I don't want to spam the forum..
For now I work around this problem by ensuring that the string does not contain CR (StringReplace).
Thanks Adrian.
Hi,
Yes I develop in C++.
StringReplace it is.
Thanks Adrian.