cool can you submit via bugzilla attached file and I'll apply it.
Patches get screwed up when sent to the list (at least for me they do)
-Andy
cool
can
On Tue, 2002-05-14 at 17:23, Laubach, Shawn - TAFB/LAB NCC (SAIC) wrote:
> Here is a patch to the headers and footers that does the extraction of the
> headers an footers of existing sheets. Solves the problem when a person
> retrieves the header repeatedly to update it.
>
>
> Index: src/java/org/apache/poi/hssf/usermodel/HSSFFooter.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFFoote
> r.java,v
> retrieving revision 1.1
> diff -u -r1.1 HSSFFooter.java
> --- src/java/org/apache/poi/hssf/usermodel/HSSFFooter.java 3 May 2002
> 04:56:42 -0000 1.1
> +++ src/java/org/apache/poi/hssf/usermodel/HSSFFooter.java 14 May 2002
> 21:18:23 -0000
> @@ -83,6 +83,42 @@
> protected HSSFFooter(FooterRecord footerRecord) {
> this.footerRecord = footerRecord;
> String foot = footerRecord.getFooter();
> + while (foot != null && foot.length() > 1) {
> + int pos = foot.length();
> + switch (foot.substring(1, 2).charAt(0)) {
> + case 'L' :
> + if (foot.indexOf("&C") >= 0) {
> + pos = Math.min(pos, foot.indexOf("&C"));
> + }
> + if (foot.indexOf("&R") >= 0) {
> + pos = Math.min(pos, foot.indexOf("&R"));
> + }
> + left = foot.substring(2, pos);
> + foot = foot.substring(pos);
> + break;
> + case 'C' :
> + if (foot.indexOf("&L") >= 0) {
> + pos = Math.min(pos, foot.indexOf("&L"));
> + }
> + if (foot.indexOf("&R") >= 0) {
> + pos = Math.min(pos, foot.indexOf("&R"));
> + }
> + center = foot.substring(2, pos);
> + foot = foot.substring(pos);
> + break;
> + case 'R' :
> + if (foot.indexOf("&C") >= 0) {
> + pos = Math.min(pos, foot.indexOf("&C"));
> + }
> + if (foot.indexOf("&L") >= 0) {
> + pos = Math.min(pos, foot.indexOf("&L"));
> + }
> + right = foot.substring(2, pos);
> + foot = foot.substring(pos);
> + break;
> + default : foot = null;
> + }
> + }
> }
>
> /**
> Index: src/java/org/apache/poi/hssf/usermodel/HSSFHeader.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFHeade
> r.java,v
> retrieving revision 1.1
> diff -u -r1.1 HSSFHeader.java
> --- src/java/org/apache/poi/hssf/usermodel/HSSFHeader.java 3 May 2002
> 04:56:42 -0000 1.1
> +++ src/java/org/apache/poi/hssf/usermodel/HSSFHeader.java 14 May 2002
> 21:18:24 -0000
> @@ -82,6 +82,42 @@
> protected HSSFHeader(HeaderRecord headerRecord) {
> this.headerRecord = headerRecord;
> String head = headerRecord.getHeader();
> + while (head != null && head.length() > 1) {
> + int pos = head.length();
> + switch (head.substring(1, 2).charAt(0)) {
> + case 'L' :
> + if (head.indexOf("&C") >= 0) {
> + pos = Math.min(pos, head.indexOf("&C"));
> + }
> + if (head.indexOf("&R") >= 0) {
> + pos = Math.min(pos, head.indexOf("&R"));
> + }
> + left = head.substring(2, pos);
> + head = head.substring(pos);
> + break;
> + case 'C' :
> + if (head.indexOf("&L") >= 0) {
> + pos = Math.min(pos, head.indexOf("&L"));
> + }
> + if (head.indexOf("&R") >= 0) {
> + pos = Math.min(pos, head.indexOf("&R"));
> + }
> + center = head.substring(2, pos);
> + head = head.substring(pos);
> + break;
> + case 'R' :
> + if (head.indexOf("&C") >= 0) {
> + pos = Math.min(pos, head.indexOf("&C"));
> + }
> + if (head.indexOf("&L") >= 0) {
> + pos = Math.min(pos, head.indexOf("&L"));
> + }
> + right = head.substring(2, pos);
> + head = head.substring(pos);
> + break;
> + default : head = null;
> + }
> + }
> }
>
> /**
>
>
>
> Shawn Laubach
> SAIC - Web Developer
> B-1B System Support Management Division
> OC-ALC/LAB, Building 3001, Tinker AFB, Oklahoma
> dsn: 336-2473 comm: 405-736-2473 mobile: 405-245-9562
>
--
http://www.superlinksoftware.com - software solutions for business
http://jakarta.apache.org/poi - Excel/Word/OLE 2 Compound Document in
Java
http://krysalis.sourceforge.net/centipede - the best build/project
structure
a guy/gal could have! - Make Ant simple on complex Projects!
The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>