You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/06/06 18:37:48 UTC

[Bug 58006] New: [PATCH] HSSF/XSSFSheet ColumnWidth VBA Compatible Methods

https://bz.apache.org/bugzilla/show_bug.cgi?id=58006

            Bug ID: 58006
           Summary: [PATCH] HSSF/XSSFSheet ColumnWidth VBA Compatible
                    Methods
           Product: POI
           Version: 3.12-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: hidekatsu.izuno@gmail.com

Created attachment 32798
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=32798&action=edit
HSSF/XSSFSheet ColumnWidth VBA Compatible Methods Patch

POI's set/getColumnWidth is not compatible EXCEL VBA. It is returned EXCEL
internal column width value.

I added or modified in HSSF/XSSFSheet below methods for getting 
the VBA compatible column width value.

- set/getStandardWidthInChars (VBA's StandardWidth)
- set/getColumnWidthInChars  (VBA's ColumnWidth)
- getColumnWidthInPoints (VBA's Width)
- getColumnWidthInPixels

These methods require the Standard Font's '0' character's width (px).
So I added ColumnWidthUtil.getStandardCharWidthInPixels(font).
This method is supported below major fonts.

- Calibri
- Arial
- Arial Unicode MS
- Century
- Georgia
- Verdana
- MS Reference Sans Serif
- Times New Roman
- Symbol
- MS Gothic
- MS Mincho
- MS PGothic
- MS PMincho
- MS UI Gothic
- MingLiU
- MingLiU_HKSCS
- MingLiU_HKSCS-ExtB
- MingLiU-ExtB
- Mongolian Baiti
- NSimSun
- Palatino Linotype
- SimHei
- SimSun
- SimSun-ExtB
- Sylfaen
- Meiryo
- Meiryo UI

I tested various conditions. But I'm not completely solve.
below methods still exist small remainders. Although it is enough 
in most cases.

- XSSFSheet#getStandardWidthInChars (error rate is less than 1/1000)
- XSSFSheet#getColumnWidthInChars (error rate is less than 1/1000)
- setStandardWidthInChars (error rate is less than 1/10)
- setColumnWidthInChars (error rate  is less than 1/10)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58006] [PATCH] HSSF/XSSFSheet ColumnWidth VBA Compatible Methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58006

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58006] [PATCH] HSSF/XSSFSheet ColumnWidth VBA Compatible Methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58006

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58006] [PATCH] HSSF/XSSFSheet ColumnWidth VBA Compatible Methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58006

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58006] [PATCH] HSSF/XSSFSheet ColumnWidth VBA Compatible Methods

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58006

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
According to the description below the patch is not in a state to be applied
directly.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org