Hmm, Perhaps you have a newer version of POI. Let me try what happens with the latest version of POI. At least I know now it should be able to work.
The code I included was just badly copied and pasted (I can't really include the literal code as it's spread out over several wrapper classes and such). In the real code the footer string does in fact end up in the setLeft(..) method call. Thanks, Frans > -----Original Message----- > From: Amol Deshmukh [mailto:[EMAIL PROTECTED] > Sent: Monday, January 31, 2005 3:21 PM > To: 'POI Users List' > Subject: RE: HSSF: Newline in header/footer? > > > Frans, > > Apparently newlines in footer works for me (\n & \r\n both work fine). > Here is my test code: > > --------------------------code------------ > import java.io.FileOutputStream; > import org.apache.poi.hssf.usermodel.HSSFFooter; > import org.apache.poi.hssf.usermodel.HSSFSheet; > import org.apache.poi.hssf.usermodel.HSSFWorkbook; > public class TestPoi { > public static void main(String[] args) throws Exception { > HSSFWorkbook wb = null; > HSSFSheet s = null; > HSSFFooter footer = null; > FileOutputStream fos = new > FileOutputStream("c:\\temp\\killme.xls"); > > wb = new HSSFWorkbook(); > s = wb.createSheet("Sheet1"); > footer = s.getFooter(); > footer.setRight("A footer with \r\n new \n lines"); > wb.write(fos); > fos.close(); > // All done. Open the file and see the print preview > } > } > --------------------------code------------ > > Incidentally, In your code, you have: > poiFooter.setLeft(pageNumbers(left)); > > and it doesnt really use the String 'footer' that you prepared > to have the new line. > > Regards, > ~ amol > > > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Monday, January 31, 2005 9:10 AM > To: '[email protected]' > Subject: HSSF: Newline in header/footer? > > > Hi, > > I'm using POI-HSSF to create Excel documents, which works > wonderfully. I > have one issue/question, though: > I would like to have a footer that spans two lines. It seems, > however, that > either HSSF or Excel ignore the newline. > > Code: > > String footer = "Data as of " + todayReadable + "; \n" + > "Data assembled by " + userName; > poiFooter = poiSheet.getFooter(); > poiFooter.setLeft(pageNumbers(left)); > > The values of the variables aren't really relevant. I've > tried using \r\n > instead of \n, but to no avail as well. > > Is there a way to insert a newline into a footer? If not, is > this an issue > in POI (and might it be fixed at some point) or is it > something in Excel (I > _am_ able to insert a newline when creating a footer in > Excel, so it seems > it is possible in Excel)? > > Thanks! > Frans > > > > ING/WIA/OPS/IT/R&F/LR&CRDB > > Location Code NA 05.61 > > P.O. Box 1800, 1000 BV Amsterdam, The Netherlands > > T +31 20 56 35388, F +31 20 56 35884 > > E [EMAIL PROTECTED] > > > > > > > ----------------------------------------------------------------- > ATTENTION: > The information in this electronic mail message is private and > confidential, and only intended for the addressee. Should you > receive this message by mistake, you are hereby notified that > any disclosure, reproduction, distribution or use of this > message is strictly prohibited. Please inform the sender by > reply transmission and delete the message without copying or > opening it. > > Messages and attachments are scanned for all viruses known. > If this message contains password-protected attachments, the > files have NOT been scanned for viruses by the ING mail domain. > Always scan attachments before opening them. > ----------------------------------------------------------------- > > > --------------------------------------------------------------------- > 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/ >
