on 2010 Jun 01 9:27 PM
I'm working on replacing our old RDC component with the new Java SDK.
I purchased Crystal Reports 2008 and downloaded the SDK. Now I'm trying to run a simple example exporting a report to word. I've built it off of the other export examples I've seen on the site. None of them seem to give me an up to date example of how to set export options though.
Exporting seems to work when I export using this:
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) report.getPrintOutputController().export(ReportExportFormat.MSWord);
But not when I do this:
ExportOptions opt = new ExportOptions();
opt.setExportFormatType(ReportExportFormat.MSWord);
RTFWordExportFormatOptions myOptions = new RTFWordExportFormatOptions();
opt.setFormatOptions(myOptions);
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) report.getPrintOutputController().export(opt);
Is there something I'm missing? I want to be able to explicitly set my export options - especially for other export formats like excel.
Request clarification before answering.
Try retrieving and modifying the saved export options, rather than constructing your own.
Here's an example for CSV:
Sincerely,
Ted Ueda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately I must still be doing something wrong. The csv is exported but it comes back with gibberish characters in the file instead of what is in my Crystal. PDF comes back fine but the other export formats (xls, doc, csv, etc.) all come back with gibberish characters.
Here is an example of the csv export code I'm using::
ExportOptions opt = new ExportOptions();
CharacterSeparatedValuesExportFormatOptions csvOptions = new CharacterSeparatedValuesExportFormatOptions();
csvOptions.setSeparator(",");
csvOptions.setDelimiter("\"");
opt.setExportFormatType(ReportExportFormat.characterSeparatedValues);
opt.setFormatOptions(csvOptions);
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) report.getPrintOutputController().export(opt);
I don't believe I can use ReportExportControl - it doesn't seem to be a part of the SDK I downloaded(but maybe I'm missing something) - I need the SDK version for Crystal Reports 2008.
I do have Microsoft Office 2003. Maybe this is causing issues?
Yes I mean incorrect character encoding.
It looks something like this:
%PDF-1.7
%âãÏÓ
7 0 obj
/<<
/Parent 5 0 R
/Resources 6 0 R
/Type /Page
/>>
endobj
6 0 obj
/<<
/Font <<
/ttf0 11 0 R
/ttf1 17 0 R
/>>
/ProcSet 21 0 R
/>>
endobj
8 0 obj
/<<
/Length 429
/>>
stream
xu0153mR[ou203A0 ~÷¯8u21224u0153ã NxkÒiÒ¤N]±´gFu0153.Su20ACÔIý÷;6£
idpà|u2014søu0153å½ÿ{¨ýÓ×
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.