RE: Auto fit height of cell values in MS Excel
Hi all, Actually, I intend to make the height to fit the value of the cell. With best regards, Anjishnu. -Original Message- From: Anjishnu Bandyopadhyay [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 11:29 AM To: poi-user@jakarta.apache.org Subject: Auto fit of cell values in MS Excel Hi all, I am generating an MS Excel sheet through POI. For a column in the sheet, I am specifying a width by using the method setColumnWidth(). Now, if the content of the cell is more, then, portions of the value in the cell are hidden. Is it possible to break the contents to the next line programmatically (the same effect that can be achieved by pressing Alt+Enter)? Thanks for your time. With best regards, Anjishnu. CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS End of Disclaimer INFOSYS***
Re: Chart sheet problem - Unable to read file
I have same case with you, i also read template and write the data on graph value range cell, and it works. I have 30 rows and 4 column data generated. this is my code /**? [EMAIL PROTECTED] java.io.File ? */ public void openFile(File file) throws Exception{ if(!file.exists() || file==null) { connected = false; throw new Exception(File didn't Exist); } FileInputStream fs=null; try{ sourceFile = file; fs = new FileInputStream(file); poiFS = new POIFSFileSystem(fs); excel = new HSSFWorkbook(poiFS); connected = true; }catch(Exception ex){ throw new Exception(Wrong File); }finally{ try{fs.close();}catch(Exception ex){} } } /**? [EMAIL PROTECTED] ?? */ public void saveFile(File file) throws Exception{ if(file==null) { connected = false; throw new Exception(File didn't Exist); } FileOutputStream os=null; ObjectOutputStream obj=null; try{ byte[] bt = excel.getBytes(); os = new FileOutputStream(file); //obj = new ObjectOutputStream(os); //obj.write(bt); excel.write(os); //poiFS.writeFilesystem(os); }catch(Exception ex){ throw new Exception(Wrong File); } finally{ //obj.close(); os.close(); } } - Original Message - From: Lucille DJARA [EMAIL PROTECTED] To: 'POI Users List' poi-user@jakarta.apache.org Sent: Monday, April 02, 2007 6:42 PM Subject: RE: Chart sheet problem - Unable to read file Hi, I am already using POI 3 Alpha version. It seems to be OK when the charts have small data (2 columns and 3 rows). And when the data is bigger I get the error. My test is this one (I only load the tenplate and write it into a new file): public class MyXLSTest { public static void main(String[] args) { copy(test_bar1.xls, output_bar1.xls); copy(test_bar2.xls, output_bar2.xls); copy(test_line1.xls, output_line1.xls); copy(test_line2.xls, output_line2.xls); } public static void copy(String input, String output){ try { POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(input)); HSSFWorkbook wb = new HSSFWorkbook(fs); FileOutputStream fileOut = new FileOutputStream(output); wb.write(fileOut); fileOut.flush(); fileOut.close(); } catch (Exception e) { e.printStackTrace(); } } } I ran this test with different input and I got this conclusion. Are you sure that it is fixed for all charts? Thank you. Lucille -Original Message- From: dedy rustandi [mailto:[EMAIL PROTECTED] Sent: 31 March 2007 02:18 To: POI Users List Subject: Re: Chart sheet problem - Unable to read file You should use POI 3 Alpha version. That bug has been fixed - Original Message - From: Lucille DJARA [EMAIL PROTECTED] To: poi-user@jakarta.apache.org Sent: Saturday, March 31, 2007 12:35 AM Subject: Chart sheet problem - Unable to read file Hi, I am trying to use the HSSF API to: 1. load a template contaning a chart sheet 2. write data 3. save the new file with the data It is OK when the chart sheet is the last sheet of my workbook, but when there are other sheets after the chart sheet I get the message Unable to read file from MS Excel. It is OK with OpenOffice. If I do Save As with OpenOffice, then I can open it with MS Excel Can somebody tell me what to do in order that my file can be open with MS Excel? Thanks Lucille No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 2007/03/30 13:15 - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.24/742 - Release Date: 2007/04/01 20:49 - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re[2]: Auto fit height of cell values in MS Excel
Hi, You should turn on word wrapping. Create a cell style with setWrapText(true) and assign it to the cell. Yegor AB Hi all, AB Actually, I intend to make the height to fit the value of the cell. AB With best regards, AB Anjishnu. AB -Original Message- AB From: Anjishnu Bandyopadhyay [mailto:[EMAIL PROTECTED] AB Sent: Wednesday, April 04, 2007 11:29 AM AB To: poi-user@jakarta.apache.org AB Subject: Auto fit of cell values in MS Excel AB Hi all, AB I am generating an MS Excel sheet through POI. AB For a column in the sheet, I am specifying a width by using the method AB setColumnWidth(). Now, if the content of the cell is more, then, AB portions of the value in the cell are hidden. Is it possible to break AB the contents to the next line programmatically (the same effect that can AB be achieved by pressing Alt+Enter)? AB Thanks for your time. AB With best regards, AB Anjishnu. AB CAUTION - Disclaimer * AB This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended AB solely for the use of the addressee(s). If you are not the intended AB recipient, please notify the sender by e-mail and delete the original AB message. Further, you are not to copy, disclose, or distribute this AB e-mail or its contents to any other person and any such actions are AB unlawful. This e-mail may contain viruses. Infosys has taken every AB reasonable precaution to minimize this risk, but is not liable for any AB damage you may sustain as a result of any virus in this e-mail. You AB should carry out your own virus checks before opening the e-mail or AB attachment. Infosys reserves the right to monitor and review the content AB of all messages sent to or from this e-mail address. Messages sent to or AB from this e-mail address may be stored on the Infosys e-mail system. AB ***INFOSYS End of Disclaimer INFOSYS*** - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
How to get String result from a cell with a formula behind
Trying to retrieve the result of a cell where I have the following formula: =SUBTOTAL(9,P4:P27) I have tried the following methods: HSSFCell.getNumericCellValue() HSSFCell.getRichStringCellValue().getString() -- returns empty string All these results do not match to what I have in my MSExcel spread sheet. Any help is greatly appreciated. Chris -- View this message in context: http://www.nabble.com/How-to-get-String-result-from-a-cell-with-a-formula-behind-tf3526397.html#a9839111 Sent from the POI - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: How to get String result from a cell with a formula behind
I'm new at this also, but you should probably use the org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator class from the scratchpad jar. -Original Message- From: ChrisHauser [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 8:49 AM To: poi-user@jakarta.apache.org Subject: How to get String result from a cell with a formula behind Trying to retrieve the result of a cell where I have the following formula: =SUBTOTAL(9,P4:P27) I have tried the following methods: HSSFCell.getNumericCellValue() HSSFCell.getRichStringCellValue().getString() -- returns empty string All these results do not match to what I have in my MSExcel spread sheet. Any help is greatly appreciated. Chris -- View this message in context: http://www.nabble.com/How-to-get-String-result-from-a-cell-wit h-a-formula-behind-tf3526392.html#a9839101 Sent from the POI - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/