Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330326

Summary: Special Characters in ExcelEmitter not correct (Encoding?)
Product: z_Archived Reporter: Dirk Gabler <dirk.gabler>
Component: BIRTAssignee: Yu Chen <yChen>
Status: CLOSED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, dirk.gabler, iv, wyan
Version: unspecified   
Target Milestone: 2.6.2   
Hardware: PC   
OS: Windows XP   
Whiteboard: Obsolete
Attachments:
Description Flags
The file checks if the pagemargin settings and special characters work none

Description Dirk Gabler CLA 2010-11-16 04:59:29 EST
Build Identifier: 2_6_2-N20101116

Reports using special characters (Umlaute, EURO-Sign) do not render them correctly in Excel-Format. They do appear correctly in PDF, DOC and HTML. 

I actually wanted to use Birt 2.6.1 but found out that the PageMargins are not set in the Excel-Format (explained here: http://www.birt-exchange.org/org/forum/index.php/topic/20859-page-border-in-xls/). I could see, that this is fixed in the 2.6.1-CVS-Branch and the CVS-Head. I could not see a 2.6.1 build containing that fix so I tried the nightly build. PageMargins are set correctly now but now 

Reproducible: Always

Steps to Reproduce:
1. Open the report design attached
2. Run it as Excel
Comment 1 Dirk Gabler CLA 2010-11-16 05:00:40 EST
Created attachment 183204 [details]
The file checks if the pagemargin settings and special characters work
Comment 2 Xiaoying Gu CLA 2010-11-16 22:54:44 EST
Hi,

I can not reproduce this issue in the 2.6.2 N-build.

Could you please attache the xls file you generated here?
Comment 3 Wei Yan CLA 2010-11-17 00:01:30 EST
The project character encoding should be changed to UTF-8 (from the preference).
Comment 4 Wei Yan CLA 2010-11-17 00:02:27 EST
(In reply to comment #3)
> The project character encoding should be changed to UTF-8 (from the
> preference).

sorry, wrong comment, please ignore it.
Comment 5 Xiaoying Gu CLA 2010-11-17 00:41:42 EST
OK, I can reproduce this issue in the latest 2.6.2 build(v20101117-0630) now.

The Umlaute, EURO-Sign were in messy code in the exported xls. And on some pc, I can not even open the xls file.
Comment 6 Yu Chen CLA 2010-11-30 00:33:27 EST
Fixed.
Comment 7 Enno CLA 2010-12-16 08:22:41 EST
Hi,
i currently use Birt Version 2.4 and this bug is actual a major problem. Waiting and upgrading for/to fix version is currently a bad option for me. Has anyone involed in this ticket/solution an idea, e. g. a patch or workaround to resolve this bug in my working birt version 2.4 ? Thanxs for any response...
Comment 8 Dirk Gabler CLA 2010-12-16 09:05:58 EST
(In reply to comment #7)
> Hi,
> i currently use Birt Version 2.4 and this bug is actual a major problem.
> Waiting and upgrading for/to fix version is currently a bad option for me. Has
> anyone involed in this ticket/solution an idea, e. g. a patch or workaround to
> resolve this bug in my working birt version 2.4 ? Thanxs for any response...

The way I worked around that bug is to take the ExcelXmlWriter out of the Eclipse-CVS and do the following patch in declareWorkSheetOptions-Method

-------------------
private void declareWorkSheetOptions( String orientation, int pageWidth,
                        int pageHeight )
        {
                writer.openTag( "WorksheetOptions" );
                writer.attribute( "xmlns", "urn:schemas-microsoft-com:office:excel" );
               
                if ( context.getHideGridlines( ) )
                {
                        writer.openTag( "DoNotDisplayGridlines" );
                        writer.closeTag( "DoNotDisplayGridlines" );
                }
                writer.openTag( "PageSetup" );
               
                // PATCH START
               
                writer.openTag( "PageMargins" );
                writer.attribute( "x:Bottom", "0.27559055118110237" );
                writer.attribute( "x:Left", "0.27559055118110237" );
                writer.attribute( "x:Right", "0.27559055118110237" );
                writer.attribute( "x:Top", "0.27559055118110237" );
                writer.closeTag( "PageMargins" );
               
                // PATCH END  
-------------------

To activate that change, you have to unjar the emitter-jar in the birt plugin directory, replace the ExcelXmlWriter.class with the compiled one including that patch. If I remember right, the plugin needs to stay unpacked and the original jar has to be removed. 

This only workes, if you need a fix border width as shown in the sample.

Cheers,
Dirk