Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 225549
Collapse All | Expand All

(-)src/org/eclipse/birt/report/engine/emitter/excel/ExcelWriter.java (+43 lines)
Lines 22-27 Link Here
22
public class ExcelWriter
22
public class ExcelWriter
23
{
23
{
24
24
25
	private boolean isRTLSheet = false; //bidi_acgc added
26
	public static final int rightToLeftisTrue = 1; //bidi_acgc added
27
25
	private XMLWriterXLS writer = new XMLWriterXLS( );
28
	private XMLWriterXLS writer = new XMLWriterXLS( );
26
29
27
	private static HashSet splitChar = new HashSet( );
30
	private static HashSet splitChar = new HashSet( );
Lines 99-104 Link Here
99
		writer.open( out, encoding );
102
		writer.open( out, encoding );
100
	}
103
	}
101
104
105
	//bidi_acgc added start
106
	//ExcelWriter constructors are overloaded in order to set the isRTLReport parameter.
107
	//isRTLReport represents the direction of the excel sheet
108
	/**
109
	 * @author bidi_acgc 
110
	 * @param isRTLSheet: represents the direction of the excel sheet.
111
	 */
112
	public ExcelWriter( OutputStream out , boolean isRTLSheet)
113
	{
114
		this.isRTLSheet = isRTLSheet;
115
		writer.open( out, "UTF-8" );
116
	}
117
	/**
118
	 * @author bidi_acgc 
119
	 * @param isRTLSheet: represents the direction of the excel sheet.
120
	 */
121
	public ExcelWriter( OutputStream out , ExcelContext context, boolean isRTLSheet )
122
	{
123
		this( out, "UTF-8" , context);
124
		this.isRTLSheet = isRTLSheet;
125
	}
126
	/**
127
	 * @author bidi_acgc
128
	 * @param isRTLSheet: represents the direction of the excel sheet.
129
	 */
130
	public ExcelWriter( OutputStream out, String encoding, ExcelContext context, boolean isRTLSheet )
131
	{
132
		this.context = context;
133
		this.isRTLSheet = isRTLSheet;
134
		writer.open( out, encoding );
135
	}
136
	//bidi_acgc added end
137
102
	// If possible, we can pass a format according the data type
138
	// If possible, we can pass a format according the data type
103
	public void writeText( Data d )
139
	public void writeText( Data d )
104
	{
140
	{
Lines 607-612 Link Here
607
	{
643
	{
608
		writer.openTag( "Worksheet" );
644
		writer.openTag( "Worksheet" );
609
		writer.attribute( "ss:Name", name );
645
		writer.attribute( "ss:Name", name );
646
		//bidi_acgc added start
647
		// Set the Excel Sheet RightToLeft attribute according to Report
648
		//if Report Bidi-Orientation is RTL, then Sheet is RTL.
649
		if (isRTLSheet)
650
			writer.attribute( "ss:RightToLeft", rightToLeftisTrue );	
651
		//else : do nothing i.e. LTR
652
		//bidi_acgc added end
610
	}
653
	}
611
654
612
	public void startSheet( int sheetIndex )
655
	public void startSheet( int sheetIndex )
(-)src/org/eclipse/birt/report/engine/emitter/excel/ExcelEmitter.java (-2 / +12 lines)
Lines 276-283 Link Here
276
	{
276
	{
277
		//Make sure the engine already calculates all data.
277
		//Make sure the engine already calculates all data.
278
		engine.complete();
278
		engine.complete();
279
		
279
		//bidi_acgc added start
280
		ExcelWriter writer = new ExcelWriter( out  , context);
280
		// Get the Report bidi Orientation property to be used for setting the
281
		// excel sheet Orientation.		
282
		boolean isRTLSheet = false;
283
		String reportOrientation = report.getDesign( ).getReportDesign( )
284
				.getBidiOrientation( );
285
		if ( "Right To Left".equalsIgnoreCase( reportOrientation ) )
286
			isRTLSheet = true;
287
		ExcelWriter writer = new ExcelWriter( out, context,isRTLSheet );
288
289
		//ExcelWriter writer = new ExcelWriter( out  , context); //bidi_acgc commented
290
		//bidi_acgc added end
281
		writer.writeDeclarations( );
291
		writer.writeDeclarations( );
282
		writer.declareStyles( engine.getStyleMap( ) );
292
		writer.declareStyles( engine.getStyleMap( ) );
283
		writer.defineNames( engine.getNamesRefer( ) );
293
		writer.defineNames( engine.getNamesRefer( ) );

Return to bug 225549