Mailing List
Home
Forum Home
Maven - Project building tool
Axis - Java SOAP implementation
Lucene - Full-featured text search engine APIs
Cocoon - MVC web framework based on XML/XSL
Fop - Create PDF, PCL, PS, SVG, XML driven by XSL formatting objects.
Log4J - A log library
POI - Java Excel, Word and other Microsoft Office files manipulating library
Oracle database error code ...
Subjects
log4j warning: No appenders could be found
java security AccessControlException: access denied (java io FilePermission clie
java lang InstantiationException: org apache tools ant Main
Apache Axis Tutorial
Subject: Struts <logic iterate >
log4j properties How to parse outpu to multiple files
configuring log4j with BEA Weblogic 8 1
How to use XSL FOP Java together
JSP precompile
Proposal: Adding jar manifest classpath in jar and war plugins
Servlet File Download dialog problem (IE6,Adobe 6 0)
java security AccessControlException: access denied (java io FilePermission
Unsupported major minor version 48 0 problem while running the an
   telope task
Subject: axis wsdl2java Ant Task usage
net sf hibernate MappingException: Error reading resource: test/User hbm xml
Building EAR ANT Script for websphere 5 0
CREATING WAR Files
Classpath problem
jsp data into Excel
Jboss 3 2 3+ vs Tomcat Axis Question
RE: How to include jars and add them into the MANIFEST MF/Class Path
attribute
Printing problem
Subject: InstantiationException
Couldn 't find trusted certificate
Please : How can one install ant 1 6 0 under Eclipse 2 1 ?
Excel: Too many different cell formats
Subject: AXIS: tomcat timeout ?
1 3 final: now giving me java io FileNotFoundException (Too many
open files)
XDoclet, Struts and Maven: Where to start? SOLUTION
Subject: Running junit tests fails
 
Why autoSizeColumn probably needs java.awt.headless=true

Why autoSizeColumn probably needs java.awt.headless=true

2007-05-04       - By Yegor Kozlov

 Back
Rober,

To calculate column width HSSFSheet.autoSizeColumn uses Java2D classes
that throw exception if graphical environment is not available.
However, some tasks such as computing text layout can be
done in a headless mode, that is in the absence of graphical
environment.

To use headless mode you must set the following system property:
java.awt.headless=true
either via -Djava.awt.headless=true startup parameter or via System.setProperty
("java.awt.headless", "true").

As Dave mentioned, there can be slight differences in the
result:
- Native graphical toolkits (WinXP or Unix with X11) are always
more precise than the headless toolkit. The way the font
metrics are calculated may be different in headless and headful modes.
Moreover, it may different on different platforms, i.e. there can be
minor differences between text metrics calculated under Solaris and
under WinXP. That is why projects that require high-precision,
platform-independent graphic calculations use their own mechanism to measure
text (for
example, Apache FOP). I don't think it's an issue in our case.
Auto-sizing in Excel is a rough operation - user needs to
APPROXIMATELY set column width to fit the text.
- If some of the fonts are not available, JDK uses the default font.
So if any fonts are missing in production you need to install them and
copy font files to $JAVA_HOME/jre/lib/fonts/.

P.S. It's good you raised this question. I'm going to update the docs
to reflect it.

Regards,
Yegor

DF> Rober,

DF> As Andy says ask on the list.

DF> In your Tomcat startup on the unix server you need to be sure to set  
DF> the following property -

DF>   -Djava.awt.headless=true

DF> Do that and all should be good.

DF> If you notice slight differences in widths between windows and unix  
DF> that may be due to the fact that autoSizeColumn uses fonts to do its  
DF> magic. (Which is why it needs the "graphic environment") So, then you  
DF> might want to install fonts into /usr/java/jre/lib/fonts/ on the unix  
DF> box. If you get stuck with that then you can ask again - Yegor can  
DF> explain the exact rules.

DF> Regards,
DF> Dave

DF> On May 3, 2007, at 6:57 PM, bugzilla@(protected) wrote:

>> DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG?
>> RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
>> <http://issues.apache.org/bugzilla/show_bug.cgi?id=42331>.
>> ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND?
>> INSERTED IN THE BUG DATABASE.
>>
>> http://issues.apache.org/bugzilla/show_bug.cgi?id=42331
>>
>>            Summary: autoSizeColumn. Exception in non graphical  
>> environment
>>            Product: POI
>>            Version: 3.0-dev
>>           Platform: Other
>>         OS/Version: other
>>             Status: NEW
>>           Severity: normal
>>           Priority: P2
>>          Component: HSSF
>>         AssignedTo: poi-dev@(protected)
>>         ReportedBy: roberjruiz@(protected)
>>
>>
>> I developed a webapp that generates excel files. Development  
>> environment is
>> Tomcat server under Windows XP. Production server is a Unix machine  
>> with no
>> graphical environment.
>>
>> autoSizeColumn method, from HSSFSheet class, works ok in windows,  
>> but throws an
>> exception in unix environment. The lack of graphical environment  
>> seems to be the
>> reason.
>>
>> --
>> Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?
>> tab=email
>> -- ---- You are receiving this mail because: -- ----
>> You are the assignee for the bug, or are watching the assignee.
>>
>> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
>> To unsubscribe, e-mail: poi-dev-unsubscribe@(protected)
>> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
>> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>>
>>


DF> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
DF> To unsubscribe, e-mail: poi-dev-unsubscribe@(protected)
DF> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
DF> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: poi-user-unsubscribe@(protected)
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/