Bug 10777

Summary: [PATCH] The current country in CountryRecord is always 1
Product: POI Reporter: Sergei Kozello <sergeikozello>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Sergei Kozello 2002-07-13 19:55:57 UTC
While saving sheet I want that current country will be set automatically 
depending on locale.
Comment 1 Sergei Kozello 2002-07-13 20:00:29 UTC
The locale depending code has been added but just for Russian.
As more contributers from different country can find out the code for their 
current country property, they can add more locale-dependent code.

Index: src/java/org/apache/poi/hssf/model/Workbook.java
===================================================================
RCS file: /home/cvspublic/jakarta-
poi/src/java/org/apache/poi/hssf/model/Workbook.java,v
retrieving revision 1.10
diff -r1.10 Workbook.java
62a63
> import java.util.Locale;
408a410
>     
418c420,425
<     public void setSheetName(int sheetnum, String sheetname) {
---
>     // for compartibility
>     public void setSheetName(int sheetnum, String sheetname ) {
>         setSheetName( sheetnum, sheetname, (byte)0 );
>     }
>     
>     public void setSheetName(int sheetnum, String sheetname, short encoding ) 
{
420,423c427,431
<         (( BoundSheetRecord ) boundsheets.get(sheetnum))
<         .setSheetname(sheetname);
<         (( BoundSheetRecord ) boundsheets.get(sheetnum))
<         .setSheetnameLength(( byte ) sheetname.length());
---
>         
>         BoundSheetRecord sheet = (BoundSheetRecord)boundsheets.get( 
sheetnum );
>         sheet.setSheetname(sheetname);
>         sheet.setSheetnameLength( (byte)sheetname.length() );
> 		sheet.setCompressedUnicodeFlag( (byte)encoding );
1581c1589,1590
<      * Creates the Country record with the default and current country set to 
1
---
>      * Creates the Country record with the default country set to 1
>      * and current country set to 7 in case of russian locale ("ru_RU") and 1 
otherwise
1591c1600,1608
<         retval.setCurrentCountry(( short ) 1);
---
>         
>         // from Russia with love ;)
>         if ( Locale.getDefault().toString().equals( "ru_RU" ) ) {
> 	        retval.setCurrentCountry(( short ) 7);
>         }
>         else {
> 	        retval.setCurrentCountry(( short ) 1);
>         }
>         
Comment 2 Andy Oliver 2002-07-15 02:18:24 UTC
Please resubmit this as an attachment (click "create a new attachment" above). 
I can't apply patches that I cut and paste from the browser, they always are
garbled.  
Sorry.  (not trying to be pedantic, I just can't make it work)

Thanks,

-Andy
Comment 3 Andy Oliver 2002-07-21 13:11:56 UTC

*** This bug has been marked as a duplicate of 10548 ***