poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 58006] New: [PATCH] HSSF/XSSFSheet ColumnWidth VBA Compatible Methods
Date Sat, 06 Jun 2015 16:37:48 GMT
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


Mime
View raw message