poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r684990 [3/3] - in /poi/branches/ooxml: ./ src/documentation/content/xdocs/ src/java/org/apache/poi/hssf/model/ src/java/org/apache/poi/hssf/record/ src/java/org/apache/poi/hssf/record/formula/ src/java/org/apache/poi/hssf/usermodel/ src/oo...
Date Mon, 11 Aug 2008 23:58:56 GMT
Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java (original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SEPX.java Mon Aug 11 16:58:54 2008
@@ -20,19 +20,20 @@
 
 package org.apache.poi.hwpf.model;
 
-import org.apache.poi.hwpf.sprm.SprmBuffer;
-import org.apache.poi.hwpf.sprm.SectionSprmUncompressor;
 import org.apache.poi.hwpf.sprm.SectionSprmCompressor;
+import org.apache.poi.hwpf.sprm.SectionSprmUncompressor;
 import org.apache.poi.hwpf.usermodel.SectionProperties;
 
-public class SEPX extends PropertyNode
+/**
+ */
+public class SEPX extends BytePropertyNode
 {
 
   SectionDescriptor _sed;
 
-  public SEPX(SectionDescriptor sed, int start, int end, byte[] grpprl)
+  public SEPX(SectionDescriptor sed, int start, int end, byte[] grpprl, boolean isUnicode)
   {
-    super(start, end, SectionSprmUncompressor.uncompressSEP(grpprl, 0));
+    super(start, end, SectionSprmUncompressor.uncompressSEP(grpprl, 0), isUnicode);
     _sed = sed;
   }
 

Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java (original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java Mon Aug 11 16:58:54 2008
@@ -34,6 +34,9 @@
   protected ArrayList _sections = new ArrayList();
   protected List _text;
 
+  /** So we can know if things are unicode or not */
+  private TextPieceTable tpt;
+
   public SectionTable()
   {
   }
@@ -41,10 +44,11 @@
 
   public SectionTable(byte[] documentStream, byte[] tableStream, int offset,
                       int size, int fcMin,
-                      List tpt)
+                      TextPieceTable tpt, CPSplitCalculator cps)
   {
     PlexOfCps sedPlex = new PlexOfCps(tableStream, offset, size, SED_SIZE);
-    _text = tpt;
+    this.tpt = tpt;
+    this._text = tpt.getTextPieces();
 
     int length = sedPlex.length();
 
@@ -54,11 +58,16 @@
       SectionDescriptor sed = new SectionDescriptor(node.getBytes(), 0);
 
       int fileOffset = sed.getFc();
+      int startAt = CPtoFC(node.getStart());
+      int endAt = CPtoFC(node.getEnd());
+      
+      boolean isUnicodeAtStart = tpt.isUnicodeAtByteOffset( startAt );
+//      System.err.println(startAt + " -> " + endAt + " = " + isUnicodeAtStart);
 
       // check for the optimization
       if (fileOffset == 0xffffffff)
       {
-        _sections.add(new SEPX(sed, CPtoFC(node.getStart()), CPtoFC(node.getEnd()), new byte[0]));
+        _sections.add(new SEPX(sed, startAt, endAt, new byte[0], isUnicodeAtStart));
       }
       else
       {
@@ -67,9 +76,34 @@
         byte[] buf = new byte[sepxSize];
         fileOffset += LittleEndian.SHORT_SIZE;
         System.arraycopy(documentStream, fileOffset, buf, 0, buf.length);
-        _sections.add(new SEPX(sed, CPtoFC(node.getStart()), CPtoFC(node.getEnd()), buf));
+        _sections.add(new SEPX(sed, startAt, endAt, buf, isUnicodeAtStart));
       }
     }
+    
+    // Some files seem to lie about their unicode status, which
+    //  is very very pesky. Try to work around these, but this
+    //  is getting on for black magic...
+    int mainEndsAt = cps.getMainDocumentEnd();
+    boolean matchAt = false;
+    boolean matchHalf = false;
+    for(int i=0; i<_sections.size(); i++) {
+    	SEPX s = (SEPX)_sections.get(i);
+    	if(s.getEnd() == mainEndsAt) {
+    		matchAt = true;
+    	} else if(s.getEndBytes() == mainEndsAt || s.getEndBytes() == mainEndsAt-1) {
+    		matchHalf = true;
+    	}
+    }
+    if(! matchAt && matchHalf) {
+    	System.err.println("Your document seemed to be mostly unicode, but the section definition was in bytes! Trying anyway, but things may well go wrong!");
+        for(int i=0; i<_sections.size(); i++) {
+        	SEPX s = (SEPX)_sections.get(i);
+            GenericPropertyNode node = sedPlex.getProperty(i);
+            
+        	s.setStart( CPtoFC(node.getStart()) );
+        	s.setEnd( CPtoFC(node.getEnd()) );
+        }
+    }
   }
 
   public void adjustForInsert(int listIndex, int length)
@@ -171,7 +205,7 @@
 
       // Line using Ryan's FCtoCP() conversion method -
       // unable to observe any effect on our testcases when using this code - piers
-      GenericPropertyNode property = new GenericPropertyNode(FCtoCP(sepx.getStart()), FCtoCP(sepx.getEnd()), sed.toByteArray());
+      GenericPropertyNode property = new GenericPropertyNode(FCtoCP(sepx.getStartBytes()), FCtoCP(sepx.getEndBytes()), sed.toByteArray());
 
 
       plex.addProperty(property);

Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java (original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPiece.java Mon Aug 11 16:58:54 2008
@@ -118,6 +118,9 @@
 	   if(end > buf.length()) {
 		   throw new StringIndexOutOfBoundsException("Index " + end + " out of range 0 -> " + buf.length());
 	   }
+	   if(end < start) {
+		   throw new StringIndexOutOfBoundsException("Asked for text from " + start + " to " + end + ", which has an end before the start!");
+	   }
 	   return buf.substring(start, end);
    }
 

Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java (original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java Mon Aug 11 16:58:54 2008
@@ -25,6 +25,9 @@
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -62,8 +65,17 @@
       pieces[x] = new PieceDescriptor(node.getBytes(), 0);
     }
 
-    int firstPieceFilePosition = pieces[0].getFilePosition();
-    _cpMin = firstPieceFilePosition - fcMin;
+    
+    // Figure out the cp of the earliest text piece
+    // Note that text pieces don't have to be stored in order!
+    _cpMin = pieces[0].getFilePosition() - fcMin;
+    for (int x = 0; x < pieces.length; x++) {
+    	int start = pieces[x].getFilePosition() - fcMin;
+    	if(start < _cpMin) {
+    		_cpMin = start;
+    	}
+    }
+
 
     // using the PieceDescriptors, build our list of TextPieces.
     for (int x = 0; x < pieces.length; x++)
@@ -93,6 +105,15 @@
       // And now build the piece
       _textPieces.add(new TextPiece(nodeStartChars, nodeEndChars, buf, pieces[x], node.getStart()));
     }
+    
+    // In the interest of our sanity, now sort the text pieces
+    //  into order, if they're not already
+    TextPiece[] tp = (TextPiece[])
+    	_textPieces.toArray(new TextPiece[_textPieces.size()]);
+    Arrays.sort(tp);
+    for(int i=0; i<tp.length; i++) {
+    	_textPieces.set(i, tp[i]);
+    }
   }
 
   public int getCpMin()
@@ -104,6 +125,62 @@
   {
     return _textPieces;
   }
+  
+  /**
+   * Is the text at the given Character offset
+   *  unicode, or plain old ascii?
+   * In a very evil fashion, you have to actually 
+   *  know this to make sense of character and
+   *  paragraph properties :(
+   * @param cp The character offset to check about
+   */
+  public boolean isUnicodeAtCharOffset(int cp) {
+	  boolean lastWas = false;
+	  
+	  Iterator it = _textPieces.iterator();
+	  while(it.hasNext()) {
+		  TextPiece tp = (TextPiece)it.next();
+		  // If the text piece covers the character, all good
+		  if(tp.getStart() <= cp && tp.getEnd() >= cp) {
+			  return tp.isUnicode();
+		  }
+		  // Otherwise keep track for the last one
+		  lastWas = tp.isUnicode();
+	  }
+	  
+	  // If they ask off the end, just go with the last one...
+	  return lastWas;
+  }
+  /**
+   * Is the text at the given byte offset
+   *  unicode, or plain old ascii?
+   * In a very evil fashion, you have to actually 
+   *  know this to make sense of character and
+   *  paragraph properties :(
+   * @param cp The character offset to check about
+   */
+  public boolean isUnicodeAtByteOffset(int bytePos) {
+	  boolean lastWas = false;
+	  int curByte = 0;
+	  
+	  Iterator it = _textPieces.iterator();
+	  while(it.hasNext()) {
+		  TextPiece tp = (TextPiece)it.next();
+		  int nextByte = curByte + tp.bytesLength();
+		  
+		  // If the text piece covers the character, all good
+		  if(curByte <= bytePos && nextByte >= bytePos) {
+			  return tp.isUnicode();
+		  }
+		  // Otherwise keep track for the last one
+		  lastWas = tp.isUnicode();
+		  // Move along
+		  curByte = nextByte;
+	  }
+	  
+	  // If they ask off the end, just go with the last one...
+	  return lastWas;
+  }
 
   public byte[] writeTo(HWPFOutputStream docStream)
     throws IOException

Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java (original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java Mon Aug 11 16:58:54 2008
@@ -70,10 +70,10 @@
         private static BitField  fFutureSavedUndo = BitFieldFactory.getInstance(0x0008);
         private static BitField  fWord97Saved = BitFieldFactory.getInstance(0x0010);
         private static BitField  fSpare0 = BitFieldFactory.getInstance(0x00FE);
-    protected  int field_11_chs;
-    protected  int field_12_chsTables;
-    protected  int field_13_fcMin;
-    protected  int field_14_fcMac;
+    protected  int field_11_chs;       /** Latest docs say this is Reserved3! */
+    protected  int field_12_chsTables; /** Latest docs say this is Reserved4! */
+    protected  int field_13_fcMin;     /** Latest docs say this is Reserved5! */
+    protected  int field_14_fcMac;     /** Latest docs say this is Reserved6! */
 
 
     public FIBAbstractType()

Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java (original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java Mon Aug 11 16:58:54 2008
@@ -155,6 +155,8 @@
     _characters = _doc.getCharacterTable().getTextRuns();
     _text = _doc.getTextTable().getTextPieces();
     _parent = new WeakReference(null);
+    
+    sanityCheckStartEnd();
   }
 
 
@@ -175,6 +177,8 @@
     _characters = parent._characters;
     _text = parent._text;
     _parent = new WeakReference(parent);
+    
+    sanityCheckStartEnd();
   }
 
   /**
@@ -226,6 +230,22 @@
         _textRangeFound = true;
         break;
     }
+    
+    sanityCheckStartEnd();
+  }
+  
+  /**
+   * Ensures that the start and end were were given
+   *  are actually valid, to avoid issues later on
+   *  if they're not
+   */
+  private void sanityCheckStartEnd() {
+	  if(_start < 0) {
+		  throw new IllegalArgumentException("Range start must not be negative. Given " + _start);
+	  }
+	  if(_end < _start) {
+		  throw new IllegalArgumentException("The end (" + _end + ") must not be before the start ("+_start+")");
+	  }
   }
 
   /**
@@ -537,13 +557,17 @@
     for (int x = _parStart; x < numParagraphs; x++)
     {
       PAPX papx = (PAPX)_paragraphs.get(x);
+      //System.err.println("Paragraph " + x + " was " + papx.getStart() + " -> " + papx.getEnd());
       papx.adjustForDelete(_start, _end - _start);
+      //System.err.println("Paragraph " + x + " is now " + papx.getStart() + " -> " + papx.getEnd());
     }
 
     for (int x = _sectionStart; x < numSections; x++)
     {
       SEPX sepx = (SEPX)_sections.get(x);
+      //System.err.println("Section " + x + " was " + sepx.getStart() + " -> " + sepx.getEnd());
       sepx.adjustForDelete(_start, _end - _start);
+      //System.err.println("Section " + x + " is now " + sepx.getStart() + " -> " + sepx.getEnd());
     }
     
     for (int x = _textStart; x < numTextPieces; x++)
@@ -650,14 +674,6 @@
                 absPlaceHolderIndex, 
 				(absPlaceHolderIndex + pPlaceHolder.length()), getDocument()
     );
-    if (subRange.usesUnicode()) {
-			absPlaceHolderIndex = getStartOffset() + (pOffset * 2);
-            subRange = new Range(
-                      absPlaceHolderIndex, 
-                      (absPlaceHolderIndex + (pPlaceHolder.length() * 2)), 
-					  getDocument()
-            );
-    }
 
 	// this Range isn't a proper parent of the subRange() so we'll have to keep
 	// track of an updated endOffset on our own
@@ -674,12 +690,6 @@
             (absPlaceHolderIndex + pPlaceHolder.length() + pValue.length()), 
 			getDocument()
     );
-    if (subRange.usesUnicode())
-            subRange = new Range(
-                      (absPlaceHolderIndex + (pValue.length() * 2)),
-                      (absPlaceHolderIndex + (pPlaceHolder.length() * 2) + 
-					  (pValue.length() * 2)), getDocument()
-            );
 
 	// deletes are automagically propagated
     subRange.delete();
@@ -820,6 +830,10 @@
     {
       throw new ArrayIndexOutOfBoundsException("The table's bounds fall outside of this Range");
     }
+    if (tableEnd < 0)
+    {
+      throw new ArrayIndexOutOfBoundsException("The table's end is negative, which isn't allowed!");
+    }
     return new Table(r._parStart, tableEnd, r._doc.getRange(), paragraph.getTableLevel());
   }
 

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestCHPBinTable.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestCHPBinTable.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestCHPBinTable.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestCHPBinTable.java Mon Aug 11 16:58:54 2008
@@ -32,6 +32,8 @@
 {
   private CHPBinTable _cHPBinTable = null;
   private HWPFDocFixture _hWPFDocFixture;
+  
+  private TextPieceTable fakeTPT = new TextPieceTable();
 
   public TestCHPBinTable(String name)
   {
@@ -46,7 +48,7 @@
     byte[] tableStream = _hWPFDocFixture._tableStream;
     int fcMin = fib.getFcMin();
 
-    _cHPBinTable = new CHPBinTable(mainStream, tableStream, fib.getFcPlcfbteChpx(), fib.getLcbPlcfbteChpx(), fcMin);
+    _cHPBinTable = new CHPBinTable(mainStream, tableStream, fib.getFcPlcfbteChpx(), fib.getLcbPlcfbteChpx(), fcMin, fakeTPT);
 
     HWPFFileSystem fileSys = new HWPFFileSystem();
 
@@ -57,7 +59,7 @@
     byte[] newTableStream = tableOut.toByteArray();
     byte[] newMainStream = mainOut.toByteArray();
 
-    CHPBinTable newBinTable = new CHPBinTable(newMainStream, newTableStream, 0, newTableStream.length, 0);
+    CHPBinTable newBinTable = new CHPBinTable(newMainStream, newTableStream, 0, newTableStream.length, 0, fakeTPT);
 
     ArrayList oldTextRuns = _cHPBinTable._textRuns;
     ArrayList newTextRuns = newBinTable._textRuns;

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPAPBinTable.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPAPBinTable.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPAPBinTable.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPAPBinTable.java Mon Aug 11 16:58:54 2008
@@ -32,6 +32,8 @@
   private PAPBinTable _pAPBinTable = null;
   private HWPFDocFixture _hWPFDocFixture;
 
+  private TextPieceTable fakeTPT = new TextPieceTable();
+
   public TestPAPBinTable(String name)
   {
     super(name);
@@ -45,7 +47,7 @@
     byte[] tableStream = _hWPFDocFixture._tableStream;
     int fcMin = fib.getFcMin();
 
-    _pAPBinTable = new PAPBinTable(mainStream, tableStream, null, fib.getFcPlcfbtePapx(), fib.getLcbPlcfbtePapx(), fcMin);
+    _pAPBinTable = new PAPBinTable(mainStream, tableStream, null, fib.getFcPlcfbtePapx(), fib.getLcbPlcfbtePapx(), fcMin, fakeTPT);
 
     HWPFFileSystem fileSys = new HWPFFileSystem();
 
@@ -56,7 +58,7 @@
     byte[] newTableStream = tableOut.toByteArray();
     byte[] newMainStream = mainOut.toByteArray();
 
-    PAPBinTable newBinTable = new PAPBinTable(newMainStream, newTableStream, null,0, newTableStream.length, 0);
+    PAPBinTable newBinTable = new PAPBinTable(newMainStream, newTableStream, null,0, newTableStream.length, 0, fakeTPT);
 
     ArrayList oldTextRuns = _pAPBinTable.getParagraphs();
     ArrayList newTextRuns = newBinTable.getParagraphs();

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSectionTable.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSectionTable.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSectionTable.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSectionTable.java Mon Aug 11 16:58:54 2008
@@ -45,13 +45,15 @@
     byte[] tableStream = _hWPFDocFixture._tableStream;
     int fcMin = fib.getFcMin();
 
+    CPSplitCalculator cps = new CPSplitCalculator(fib);
+    
     ComplexFileTable cft = new ComplexFileTable(mainStream, tableStream, fib.getFcClx(), fcMin);
     TextPieceTable tpt = cft.getTextPieceTable();
 
     SectionTable sectionTable = new SectionTable(mainStream, tableStream,
                                                  fib.getFcPlcfsed(),
                                                  fib.getLcbPlcfsed(),
-                                                 fcMin, tpt.getTextPieces());
+                                                 fcMin, tpt, cps);
     HWPFFileSystem fileSys = new HWPFFileSystem();
 
     sectionTable.writeTo(fileSys, 0);
@@ -61,7 +63,9 @@
     byte[] newTableStream = tableOut.toByteArray();
     byte[] newMainStream = mainOut.toByteArray();
 
-    SectionTable newSectionTable = new SectionTable(newMainStream, newTableStream, 0, newTableStream.length, 0, tpt.getTextPieces());
+    SectionTable newSectionTable = new SectionTable(
+    		newMainStream, newTableStream, 0, 
+    		newTableStream.length, 0, tpt, cps);
 
     ArrayList oldSections = sectionTable.getSections();
     ArrayList newSections = newSectionTable.getSections();

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java Mon Aug 11 16:58:54 2008
@@ -81,9 +81,16 @@
     	HWPFDocument doc = new HWPFDocument(new FileInputStream(
     			new File(dirname, "Bug44292.doc")));
 		Range r = doc.getRange();
+		assertEquals(6, r.numParagraphs());
+		assertEquals(0, r.getStartOffset());
+		assertEquals(87, r.getEndOffset());
 			
-		//get the table
+		// Paragraph with table
 		Paragraph p = r.getParagraph(0);
+		assertEquals(0, p.getStartOffset());
+		assertEquals(20, p.getEndOffset());
+		
+		// Get the table
 		Table t = r.getTable(p);
 		
 		//get the only row

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java Mon Aug 11 16:58:54 2008
@@ -18,27 +18,28 @@
 
 package org.apache.poi.hwpf.usermodel;
 
-import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
-import java.util.List;
-
-import org.apache.poi.hwpf.HWPFDocument;
-import org.apache.poi.hwpf.model.PicturesTable;
-import org.apache.poi.hwpf.usermodel.Picture;
 
 import junit.framework.TestCase;
 
+import org.apache.poi.hwpf.HWPFDocument;
+import org.apache.poi.hwpf.model.PAPX;
+
 /**
  *	Test to see if Range.delete() works even if the Range contains a
  *	CharacterRun that uses Unicode characters.
- *
- * TODO - re-enable me when unicode paragraph stuff is fixed!
  */
-public abstract class TestRangeDelete extends TestCase {
+public class TestRangeDelete extends TestCase {
 
 	// u201c and u201d are "smart-quotes"
+	private String introText = 
+		"Introduction\r";
+	private String fillerText = 
+		"${delete} This is an MS-Word 97 formatted document created using NeoOffice v. 2.2.4 Patch 0 (OpenOffice.org v. 2.2.1).\r";
 	private String originalText =
 		"It is used to confirm that text delete works even if Unicode characters (such as \u201c\u2014\u201d (U+2014), \u201c\u2e8e\u201d (U+2E8E), or \u201c\u2714\u201d (U+2714)) are present.  Everybody should be thankful to the ${organization} ${delete} and all the POI contributors for their assistance in this matter.\r";
+	private String lastText =
+		"Thank you, ${organization} ${delete}!\r";
 	private String searchText = "${delete}";
 	private String expectedText1 = " This is an MS-Word 97 formatted document created using NeoOffice v. 2.2.4 Patch 0 (OpenOffice.org v. 2.2.1).\r";
 	private String expectedText2 =
@@ -68,32 +69,63 @@
 	public void testDocStructure() throws Exception {
 
 		HWPFDocument daDoc = new HWPFDocument(new FileInputStream(illustrativeDocFile));
+		Range range;
+		Section section;
+		Paragraph para;
+		PAPX paraDef;
 
-		Range range = daDoc.getOverallRange();
-
+		// First, check overall
+		range = daDoc.getOverallRange();
 		assertEquals(1, range.numSections());
-		Section section = range.getSection(0);
-
-		assertEquals(5, section.numParagraphs());
-		Paragraph para = section.getParagraph(2);
-
-		assertEquals(5, para.numCharacterRuns());
-
-		assertEquals(originalText, para.text());
+		assertEquals(5, range.numParagraphs());
 		
 		
-		// Now check on just the main text
+		// Now, onto just the doc bit
 		range = daDoc.getRange();
-		
+
 		assertEquals(1, range.numSections());
+		assertEquals(1, daDoc.getSectionTable().getSections().size());
 		section = range.getSection(0);
-
+		
 		assertEquals(5, section.numParagraphs());
+		
+		para = section.getParagraph(0);
+		assertEquals(1, para.numCharacterRuns());
+		assertEquals(introText, para.text());
+		
+		para = section.getParagraph(1);
+		assertEquals(5, para.numCharacterRuns());
+		assertEquals(fillerText, para.text());
+		
+		
+		paraDef = (PAPX)daDoc.getParagraphTable().getParagraphs().get(2);
+		assertEquals(132, paraDef.getStart());
+		assertEquals(400, paraDef.getEnd());
+		
 		para = section.getParagraph(2);
-
 		assertEquals(5, para.numCharacterRuns());
-
 		assertEquals(originalText, para.text());
+		
+		
+		paraDef = (PAPX)daDoc.getParagraphTable().getParagraphs().get(3);
+		assertEquals(400, paraDef.getStart());
+		assertEquals(438, paraDef.getEnd());
+		
+		para = section.getParagraph(3);
+		assertEquals(1, para.numCharacterRuns());
+		assertEquals(lastText, para.text());
+		
+		
+		// Check things match on text length
+		assertEquals(439, range.text().length());
+		assertEquals(439, section.text().length());
+		assertEquals(439, 
+				section.getParagraph(0).text().length() +
+				section.getParagraph(1).text().length() +
+				section.getParagraph(2).text().length() +
+				section.getParagraph(3).text().length() +
+				section.getParagraph(4).text().length()
+		);
 	}
 
 	/**
@@ -118,12 +150,7 @@
 		assertEquals(192, offset);
 
 		int absOffset = para.getStartOffset() + offset;
-		if (para.usesUnicode())
-			absOffset = para.getStartOffset() + (offset * 2);
-
 		Range subRange = new Range(absOffset, (absOffset + searchText.length()), para.getDocument());
-		if (subRange.usesUnicode())
-			subRange = new Range(absOffset, (absOffset + (searchText.length() * 2)), para.getDocument());
 
 		assertEquals(searchText, subRange.text());
 
@@ -167,26 +194,23 @@
 
 		boolean keepLooking = true;
 		while (keepLooking) {
-
+			// Reload the range every time
+			range = daDoc.getRange();
 			int offset = range.text().indexOf(searchText);
 			if (offset >= 0) {
 
 				int absOffset = range.getStartOffset() + offset;
-				if (range.usesUnicode())
-					absOffset = range.getStartOffset() + (offset * 2);
 
 				Range subRange = new Range(
 					absOffset, (absOffset + searchText.length()), range.getDocument());
-				if (subRange.usesUnicode())
-					subRange = new Range(
-						absOffset, (absOffset + (searchText.length() * 2)), range.getDocument());
 
 				assertEquals(searchText, subRange.text());
 
 				subRange.delete();
 
-			} else
+			} else {
 				keepLooking = false;
+			}
 		}
 
 		// we need to let the model re-calculate the Range before we use it
@@ -197,6 +221,10 @@
 
 		assertEquals(5, section.numParagraphs());
 
+		para = section.getParagraph(0);
+		text = para.text();
+		assertEquals(introText, text);
+
 		para = section.getParagraph(1);
 		text = para.text();
 		assertEquals(expectedText1, text);

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java Mon Aug 11 16:58:54 2008
@@ -18,29 +18,25 @@
 
 package org.apache.poi.hwpf.usermodel;
 
-import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
-import java.util.List;
-
-import org.apache.poi.hwpf.HWPFDocument;
-import org.apache.poi.hwpf.model.PicturesTable;
-import org.apache.poi.hwpf.usermodel.Picture;
 
 import junit.framework.TestCase;
 
+import org.apache.poi.hwpf.HWPFDocument;
+
 /**
  *	Test to see if Range.insertBefore() works even if the Range contains a
  *	CharacterRun that uses Unicode characters.
  *
  * TODO - re-enable me when unicode paragraph stuff is fixed!
  */
-public abstract class TestRangeInsertion extends TestCase {
+public class TestRangeInsertion extends TestCase {
 
 	// u201c and u201d are "smart-quotes"
 	private String originalText =
 		"It is used to confirm that text insertion works even if Unicode characters (such as \u201c\u2014\u201d (U+2014), \u201c\u2e8e\u201d (U+2E8E), or \u201c\u2714\u201d (U+2714)) are present.\r";
 	private String textToInsert = "Look at me!  I'm cool!  ";
-	private int insertionPoint = 244;
+	private int insertionPoint = 122;
 
 	private String illustrativeDocFile;
 
@@ -73,12 +69,18 @@
 
 		assertEquals(3, section.numParagraphs());
 		Paragraph para = section.getParagraph(2);
+		assertEquals(originalText, para.text());
 
 		assertEquals(3, para.numCharacterRuns());
-		String text = para.getCharacterRun(0).text() + para.getCharacterRun(1).text() +
-			para.getCharacterRun(2).text();
+		String text = 
+			para.getCharacterRun(0).text() + 
+			para.getCharacterRun(1).text() +
+			para.getCharacterRun(2).text()
+		;
 
 		assertEquals(originalText, text);
+		
+		assertEquals(insertionPoint, para.getStartOffset());
 	}
 
 	/**
@@ -109,10 +111,14 @@
 
 		assertEquals(3, section.numParagraphs());
 		Paragraph para = section.getParagraph(2);
+		assertEquals((textToInsert + originalText), para.text());
 
 		assertEquals(3, para.numCharacterRuns());
-		String text = para.getCharacterRun(0).text() + para.getCharacterRun(1).text() +
-			para.getCharacterRun(2).text();
+		String text = 
+			para.getCharacterRun(0).text() + 
+			para.getCharacterRun(1).text() +
+			para.getCharacterRun(2).text()
+		;
 
 		// System.out.println(text);
 

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeProperties.java Mon Aug 11 16:58:54 2008
@@ -18,8 +18,10 @@
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.util.List;
 
 import org.apache.poi.hwpf.HWPFDocument;
+import org.apache.poi.hwpf.model.PropertyNode;
 
 import junit.framework.TestCase;
 
@@ -30,7 +32,7 @@
  *
  * TODO - re-enable me when unicode paragraph stuff is fixed!
  */
-public abstract class TestRangeProperties extends TestCase {
+public class TestRangeProperties extends TestCase {
 	private static final char page_break = (char)12;
 	
 	private static final String u_page_1 =
@@ -85,6 +87,16 @@
 				r.text()
 		);
 		
+		assertEquals(1, r.numSections());
+		assertEquals(1, a.getSectionTable().getSections().size());
+		Section s = r.getSection(0);
+		assertEquals(
+				a_page_1 +
+				page_break + "\r" + 
+				a_page_2,
+				s.text()
+		);
+		
 		assertEquals(
 				7,
 				r.numParagraphs()
@@ -142,8 +154,102 @@
 		assertEquals(22, c1.getFontSize());
 		assertEquals(32, c7.getFontSize());
 	}
+
+	/**
+	 * Tests the raw definitions of the paragraphs of
+	 *  a unicode document
+	 */
+	public void testUnicodeParagraphDefinitions() throws Exception {
+		Range r = u.getRange();
+		String[] p1_parts = u_page_1.split("\r");
+		String[] p2_parts = u_page_2.split("\r");
+		
+		assertEquals(
+				u_page_1 + page_break + "\r" + u_page_2,
+				r.text()
+		);
+		assertEquals(
+				408, r.text().length()
+		);
 	
+		
+		assertEquals(1, r.numSections());
+		assertEquals(1, u.getSectionTable().getSections().size());
+		Section s = r.getSection(0);
+		assertEquals(
+				u_page_1 +
+				page_break + "\r" + 
+				u_page_2,
+				s.text()
+		);
+		assertEquals(0, s.getStartOffset());
+		assertEquals(408, s.getEndOffset());
+
+		
+		List pDefs = r._paragraphs;
+		assertEquals(35, pDefs.size());
+		
+		// Check that the last paragraph ends where it should do
+		assertEquals(531, u.getOverallRange().text().length());
+		assertEquals(530, u.getCPSplitCalculator().getHeaderTextboxEnd());
+		PropertyNode pLast = (PropertyNode)pDefs.get(34);
+//		assertEquals(530, pLast.getEnd());
+		
+		// Only care about the first few really though
+		PropertyNode p0 = (PropertyNode)pDefs.get(0);
+		PropertyNode p1 = (PropertyNode)pDefs.get(1);
+		PropertyNode p2 = (PropertyNode)pDefs.get(2);
+		PropertyNode p3 = (PropertyNode)pDefs.get(3);
+		PropertyNode p4 = (PropertyNode)pDefs.get(4);
+		
+		// 5 paragraphs should get us to the end of our text
+		assertTrue(p0.getStart() < 408);
+		assertTrue(p0.getEnd() < 408);
+		assertTrue(p1.getStart() < 408);
+		assertTrue(p1.getEnd() < 408);
+		assertTrue(p2.getStart() < 408);
+		assertTrue(p2.getEnd() < 408);
+		assertTrue(p3.getStart() < 408);
+		assertTrue(p3.getEnd() < 408);
+		assertTrue(p4.getStart() < 408);
+		assertTrue(p4.getEnd() < 408);
+		
+		// Paragraphs should match with lines
+		assertEquals(
+				0,
+				p0.getStart()
+		);
+		assertEquals(
+				p1_parts[0].length() + 1,
+				p0.getEnd()
+		);
+		
+		assertEquals(
+				p1_parts[0].length() + 1,
+				p1.getStart()
+		);		
+		assertEquals(
+				p1_parts[0].length() + 1 +
+				p1_parts[1].length() + 1,
+				p1.getEnd()
+		);
+		
+		assertEquals(
+				p1_parts[0].length() + 1 +
+				p1_parts[1].length() + 1,
+				p2.getStart()
+		);
+		assertEquals(
+				p1_parts[0].length() + 1 +
+				p1_parts[1].length() + 1 +
+				p1_parts[2].length() + 1,
+				p2.getEnd()
+		);
+	}
 
+	/**
+	 * Tests the paragraph text of a unicode document
+	 */
 	public void testUnicodeTextParagraphs() throws Exception {
 		Range r = u.getRange();
 		assertEquals(
@@ -154,16 +260,112 @@
 		);
 		
 		assertEquals(
-				5,
+				12,
 				r.numParagraphs()
 		);
 		String[] p1_parts = u_page_1.split("\r");
 		String[] p2_parts = u_page_2.split("\r");
 		
-		System.out.println(r.getParagraph(2).text());
-		// TODO
+		// Check text all matches up properly
+		assertEquals(p1_parts[0] + "\r", r.getParagraph(0).text());
+		assertEquals(p1_parts[1] + "\r", r.getParagraph(1).text());
+		assertEquals(p1_parts[2] + "\r", r.getParagraph(2).text());
+		assertEquals(p1_parts[3] + "\r", r.getParagraph(3).text());
+		assertEquals(p1_parts[4] + "\r", r.getParagraph(4).text());
+		assertEquals(p1_parts[5] + "\r", r.getParagraph(5).text());
+		assertEquals(p1_parts[6] + "\r", r.getParagraph(6).text());
+		assertEquals(p1_parts[7] + "\r", r.getParagraph(7).text());
+		assertEquals(p1_parts[8] + "\r", r.getParagraph(8).text());
+		assertEquals(p1_parts[9] + "\r", r.getParagraph(9).text());
+		assertEquals(page_break + "\r", r.getParagraph(10).text());
+		assertEquals(p2_parts[0] + "\r", r.getParagraph(11).text());
 	}
 	public void testUnicodeStyling() throws Exception {
-		// TODO
+		Range r = u.getRange();
+		String[] p1_parts = u_page_1.split("\r");
+		
+		Paragraph p1 = r.getParagraph(0);
+		Paragraph p7 = r.getParagraph(6);
+		
+		// Line ending in its own run each time!
+		assertEquals(2, p1.numCharacterRuns());
+		assertEquals(2, p7.numCharacterRuns());
+		
+		CharacterRun c1a = p1.getCharacterRun(0);
+		CharacterRun c1b = p1.getCharacterRun(1);
+		CharacterRun c7a = p7.getCharacterRun(0);
+		CharacterRun c7b = p7.getCharacterRun(1);
+		
+		assertEquals("Times New Roman", c1a.getFontName()); // No Calibri
+		assertEquals(22, c1a.getFontSize());
+		
+		assertEquals("Times New Roman", c1b.getFontName()); // No Calibri
+		assertEquals(22, c1b.getFontSize());
+		
+		assertEquals("Times New Roman", c7a.getFontName());
+		assertEquals(48, c7a.getFontSize());
+		
+		assertEquals("Times New Roman", c7b.getFontName());
+		assertEquals(48, c7b.getFontSize());
+		
+		// Now check where they crop up
+		assertEquals(
+				0, 
+				c1a.getStartOffset()
+		);
+		assertEquals(
+				p1_parts[0].length(), 
+				c1a.getEndOffset()
+		);
+		
+		assertEquals(
+				p1_parts[0].length(), 
+				c1b.getStartOffset()
+		);
+		assertEquals(
+				p1_parts[0].length()+1, 
+				c1b.getEndOffset()
+		);
+		
+		assertEquals(
+				p1_parts[0].length() + 1 + 
+				p1_parts[1].length() + 1 + 
+				p1_parts[2].length() + 1 + 
+				p1_parts[3].length() + 1 + 
+				p1_parts[4].length() + 1 + 
+				p1_parts[5].length() + 1, 
+				c7a.getStartOffset()
+		);
+		assertEquals(
+				p1_parts[0].length() + 1 + 
+				p1_parts[1].length() + 1 + 
+				p1_parts[2].length() + 1 + 
+				p1_parts[3].length() + 1 + 
+				p1_parts[4].length() + 1 + 
+				p1_parts[5].length() + 1 +
+				1,
+				c7a.getEndOffset()
+		);
+		
+		assertEquals(
+				p1_parts[0].length() + 1 + 
+				p1_parts[1].length() + 1 + 
+				p1_parts[2].length() + 1 + 
+				p1_parts[3].length() + 1 + 
+				p1_parts[4].length() + 1 + 
+				p1_parts[5].length() + 1 +
+				1, 
+				c7b.getStartOffset()
+		);
+		assertEquals(
+				p1_parts[0].length() + 1 + 
+				p1_parts[1].length() + 1 + 
+				p1_parts[2].length() + 1 + 
+				p1_parts[3].length() + 1 + 
+				p1_parts[4].length() + 1 + 
+				p1_parts[5].length() + 1 +
+				p1_parts[6].length() + 1,
+				c7b.getEndOffset()
+		);
 	}
 }

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java (original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java Mon Aug 11 16:58:54 2008
@@ -18,23 +18,19 @@
 
 package org.apache.poi.hwpf.usermodel;
 
-import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
-import java.util.List;
-
-import org.apache.poi.hwpf.HWPFDocument;
-import org.apache.poi.hwpf.model.PicturesTable;
-import org.apache.poi.hwpf.usermodel.Picture;
 
 import junit.framework.TestCase;
 
+import org.apache.poi.hwpf.HWPFDocument;
+
 /**
  *	Test to see if Range.replaceText() works even if the Range contains a
  *	CharacterRun that uses Unicode characters.
  *
  * TODO - re-enable me when unicode paragraph stuff is fixed!
  */
-public abstract class TestRangeReplacement extends TestCase {
+public class TestRangeReplacement extends TestCase {
 
 	// u201c and u201d are "smart-quotes"
 	private String originalText =
@@ -70,16 +66,23 @@
 		HWPFDocument daDoc = new HWPFDocument(new FileInputStream(illustrativeDocFile));
 
 		Range range = daDoc.getRange();
+		assertEquals(414, range.text().length());
 
 		assertEquals(1, range.numSections());
 		Section section = range.getSection(0);
+		assertEquals(414, section.text().length());
 
 		assertEquals(5, section.numParagraphs());
 		Paragraph para = section.getParagraph(2);
 
 		assertEquals(5, para.numCharacterRuns());
-		String text = para.getCharacterRun(0).text() + para.getCharacterRun(1).text() +
-			para.getCharacterRun(2).text() + para.getCharacterRun(3).text() + para.getCharacterRun(4).text();
+		String text = 
+			para.getCharacterRun(0).text() + 
+			para.getCharacterRun(1).text() +
+			para.getCharacterRun(2).text() +
+			para.getCharacterRun(3).text() +
+			para.getCharacterRun(4).text()
+		;
 
 		assertEquals(originalText, text);
 	}

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
Binary files - no diff available.

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java Mon Aug 11 16:58:54 2008
@@ -20,6 +20,7 @@
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 
+import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.model.FormulaParser.FormulaParseException;
 import org.apache.poi.hssf.record.formula.AbstractFunctionPtg;
 import org.apache.poi.hssf.record.formula.AddPtg;
@@ -123,12 +124,15 @@
 	}
 
 	public void testMacroFunction() {
-		HSSFWorkbook w = new HSSFWorkbook();
-		Ptg[] ptg = FormulaParser.parse("FOO()", w);
+		// testNames.xls contains a VB function called 'myFunc'
+		HSSFWorkbook w = HSSFTestDataSamples.openSampleWorkbook("testNames.xls");
+
+		Ptg[] ptg = FormulaParser.parse("myFunc()", w);
+		// myFunc() actually takes 1 parameter.  Don't know if POI will ever be able to detect this problem
 
 		// the name gets encoded as the first arg
 		NamePtg tname = (NamePtg) ptg[0];
-		assertEquals("FOO", tname.toFormulaString(w));
+		assertEquals("myFunc", tname.toFormulaString(w));
 
 		AbstractFunctionPtg tfunc = (AbstractFunctionPtg) ptg[1];
 		assertTrue(tfunc.isExternalFunction());

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/TestExternalFunctionFormulas.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/TestExternalFunctionFormulas.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/TestExternalFunctionFormulas.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/TestExternalFunctionFormulas.java Mon Aug 11 16:58:54 2008
@@ -17,11 +17,19 @@
 
 package org.apache.poi.hssf.record.formula;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
 import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.model.FormulaParser;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.FormulaEvaluator.CellValue;
 /**
  * Tests for functions from external workbooks (e.g. YEARFRAC).
  * 
@@ -30,17 +38,45 @@
  */
 public final class TestExternalFunctionFormulas extends TestCase {
 
-    
-    /**
-     * tests <tt>NameXPtg.toFormulaString(Workbook)</tt> and logic in Workbook below that   
-     */
-    public void testReadFormulaContainingExternalFunction() {
-        HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("externalFunctionExample.xls");
-        
-        String expectedFormula = "YEARFRAC(B1,C1)";
-        HSSFSheet sht = wb.getSheetAt(0);
-        String cellFormula = sht.getRow(0).getCell((short)0).getCellFormula();
-        assertEquals(expectedFormula, cellFormula);
-    }
-    
+	/**
+	 * tests <tt>NameXPtg.toFormulaString(Workbook)</tt> and logic in Workbook below that   
+	 */
+	public void testReadFormulaContainingExternalFunction() {
+		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("externalFunctionExample.xls");
+		
+		String expectedFormula = "YEARFRAC(B1,C1)";
+		HSSFSheet sht = wb.getSheetAt(0);
+		String cellFormula = sht.getRow(0).getCell(0).getCellFormula();
+		assertEquals(expectedFormula, cellFormula);
+	}
+	
+	public void testParse() {
+		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("externalFunctionExample.xls");
+		Ptg[] ptgs = FormulaParser.parse("YEARFRAC(B1,C1)", wb);
+		assertEquals(4, ptgs.length);
+		assertEquals(NameXPtg.class, ptgs[0].getClass());
+		
+		wb.getSheetAt(0).getRow(0).createCell(6).setCellFormula("YEARFRAC(C1,B1)");
+		if (false) {
+			// In case you fancy checking in excel
+			try {
+				File tempFile = File.createTempFile("testExtFunc", ".xls");
+				FileOutputStream fout = new FileOutputStream(tempFile);
+				wb.write(fout);
+				fout.close();
+				System.out.println("check out " + tempFile.getAbsolutePath());
+			} catch (IOException e) {
+				throw new RuntimeException(e);
+			}
+		}
+	}
+	
+	public void DISABLEDtestEvaluate() {
+		HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("externalFunctionExample.xls");
+		HSSFSheet sheet = wb.getSheetAt(0);
+		HSSFCell cell = sheet.getRow(0).getCell(0);
+		HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(sheet, wb);
+		CellValue evalResult = fe.evaluate(cell);
+		evalResult.toString();
+	}
 }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/TestExternalFunction.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/TestExternalFunction.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/TestExternalFunction.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/eval/TestExternalFunction.java Mon Aug 11 16:58:54 2008
@@ -17,8 +17,11 @@
 
 package org.apache.poi.hssf.record.formula.eval;
 
+import java.io.IOException;
+
 import junit.framework.TestCase;
 
+import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
 import org.apache.poi.hssf.usermodel.HSSFName;
@@ -34,20 +37,33 @@
 
 	/**
 	 * Checks that an external function can get invoked from the formula evaluator. 
+	 * @throws IOException 
+
 	 */
 	public void testInvoke() {
-        HSSFWorkbook wb = new HSSFWorkbook();
-        HSSFSheet sheet = wb.createSheet();
-        wb.setSheetName(0, "Sheet1");
-        HSSFRow row = sheet.createRow(0);
-        HSSFCell cell = row.createCell(0);
-
-        HSSFName hssfName = wb.createName();
-        hssfName.setNameName("myFunc");
-        
-        cell.setCellFormula("myFunc()");
-        String actualFormula=cell.getCellFormula();
-        assertEquals("myFunc()", actualFormula);
+		
+		HSSFWorkbook wb;
+		HSSFSheet sheet;
+		HSSFCell cell;
+		if (false) {
+			// TODO - this code won't work until we can create user-defined functions directly with POI
+			wb = new HSSFWorkbook();
+			sheet = wb.createSheet();
+			wb.setSheetName(0, "Sheet1");
+			HSSFName hssfName = wb.createName();
+			hssfName.setNameName("myFunc");
+			
+		} else {
+			// This sample spreadsheet already has a VB function called 'myFunc'
+			wb = HSSFTestDataSamples.openSampleWorkbook("testNames.xls");
+			sheet = wb.getSheetAt(0);
+			HSSFRow row = sheet.createRow(0);
+			cell = row.createCell(1);
+		}
+		
+		cell.setCellFormula("myFunc()");
+		String actualFormula=cell.getCellFormula();
+		assertEquals("myFunc()", actualFormula);
 		
 		HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(sheet, wb);
 		CellValue evalResult = fe.evaluate(cell);

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Mon Aug 11 16:58:54 2008
@@ -417,6 +417,9 @@
         for(int i = 0 ; i < wb.getNumberOfNames(); i++){
           HSSFName name = wb.getNameAt(i);
           name.getNameName();
+          if (name.isFunctionName()) {
+              continue;
+          }
           name.getReference();
         }
     }
@@ -1004,7 +1007,6 @@
      * Test that we can delete sheets without
      *  breaking the build in named ranges
      *  used for printing stuff.
-     * Currently broken, as we change the Ptg
      */
     public void test30978() {
         HSSFWorkbook wb = openSample("30978-alt.xls");
@@ -1016,7 +1018,7 @@
         Workbook w = wb.getWorkbook();
         for(int i=0; i<w.getNumNames(); i++) {
             NameRecord r = w.getNameRecord(i);
-            assertTrue(r.getIndexToSheet() <= wb.getNumberOfSheets());
+            assertTrue(r.getSheetNumber() <= wb.getNumberOfSheets());
             
             List nd = r.getNameDefinition();
             assertEquals(1, nd.size());
@@ -1034,7 +1036,7 @@
         
         for(int i=0; i<w.getNumNames(); i++) {
             NameRecord r = w.getNameRecord(i);
-            assertTrue(r.getIndexToSheet() <= wb.getNumberOfSheets());
+            assertTrue(r.getSheetNumber() <= wb.getNumberOfSheets());
             
             List nd = r.getNameDefinition();
             assertEquals(1, nd.size());
@@ -1051,7 +1053,7 @@
         
         for(int i=0; i<w.getNumNames(); i++) {
             NameRecord r = w.getNameRecord(i);
-            assertTrue(r.getIndexToSheet() <= wb.getNumberOfSheets());
+            assertTrue(r.getSheetNumber() <= wb.getNumberOfSheets());
             
             List nd = r.getNameDefinition();
             assertEquals(1, nd.size());

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java Mon Aug 11 16:58:54 2008
@@ -50,7 +50,7 @@
         b.createSheet();
         b.setRepeatingRowsAndColumns( 2, 0,1,-1,-1 );
         NameRecord nameRecord = b.getWorkbook().getNameRecord( 0 );
-        assertEquals( 3, nameRecord.getIndexToSheet() );
+        assertEquals(3, nameRecord.getSheetNumber());
     }
 
     public void testCaseInsensitiveNames() {
@@ -411,84 +411,84 @@
      *  that point to deleted sheets
      */
     public void testNamesToDeleteSheets() throws Exception {
-    	HSSFWorkbook b = openSample("30978-deleted.xls");
-    	assertEquals(3, b.getNumberOfNames());
-    	
-    	// Sheet 2 is deleted
-    	assertEquals("Sheet1", b.getSheetName(0));
-    	assertEquals("Sheet3", b.getSheetName(1));
-    	
-    	Area3DPtg ptg;
-    	NameRecord nr;
-    	HSSFName n;
-    	
-    	/* ======= Name pointing to deleted sheet ====== */
-    	
-    	// First at low level
-    	nr = b.getWorkbook().getNameRecord(0);
-    	assertEquals("On2", nr.getNameText());
-    	assertEquals(0, nr.getIndexToSheet());
-    	assertEquals(1, nr.getExternSheetNumber());
-    	assertEquals(1, nr.getNameDefinition().size());
-    	
-    	ptg = (Area3DPtg)nr.getNameDefinition().get(0);
-    	assertEquals(1, ptg.getExternSheetIndex());
-    	assertEquals(0, ptg.getFirstColumn());
-    	assertEquals(0, ptg.getFirstRow());
-    	assertEquals(0, ptg.getLastColumn());
-    	assertEquals(2, ptg.getLastRow());
-    	
-    	// Now at high level
-    	n = b.getNameAt(0);
-    	assertEquals("On2", n.getNameName());
-    	assertEquals("", n.getSheetName());
-    	assertEquals("#REF!$A$1:$A$3", n.getReference());
-    	
-    	
-    	/* ======= Name pointing to 1st sheet ====== */
-    	
-    	// First at low level
-    	nr = b.getWorkbook().getNameRecord(1);
-    	assertEquals("OnOne", nr.getNameText());
-    	assertEquals(0, nr.getIndexToSheet());
-    	assertEquals(0, nr.getExternSheetNumber());
-    	assertEquals(1, nr.getNameDefinition().size());
-    	
-    	ptg = (Area3DPtg)nr.getNameDefinition().get(0);
-    	assertEquals(0, ptg.getExternSheetIndex());
-    	assertEquals(0, ptg.getFirstColumn());
-    	assertEquals(2, ptg.getFirstRow());
-    	assertEquals(0, ptg.getLastColumn());
-    	assertEquals(3, ptg.getLastRow());
-    	
-    	// Now at high level
-    	n = b.getNameAt(1);
-    	assertEquals("OnOne", n.getNameName());
-    	assertEquals("Sheet1", n.getSheetName());
-    	assertEquals("Sheet1!$A$3:$A$4", n.getReference());
-    	
-    	
-    	/* ======= Name pointing to 3rd sheet ====== */
-    	
-    	// First at low level
-    	nr = b.getWorkbook().getNameRecord(2);
-    	assertEquals("OnSheet3", nr.getNameText());
-    	assertEquals(0, nr.getIndexToSheet());
-    	assertEquals(2, nr.getExternSheetNumber());
-    	assertEquals(1, nr.getNameDefinition().size());
-    	
-    	ptg = (Area3DPtg)nr.getNameDefinition().get(0);
-    	assertEquals(2, ptg.getExternSheetIndex());
-    	assertEquals(0, ptg.getFirstColumn());
-    	assertEquals(0, ptg.getFirstRow());
-    	assertEquals(0, ptg.getLastColumn());
-    	assertEquals(1, ptg.getLastRow());
-    	
-    	// Now at high level
-    	n = b.getNameAt(2);
-    	assertEquals("OnSheet3", n.getNameName());
-    	assertEquals("Sheet3", n.getSheetName());
-    	assertEquals("Sheet3!$A$1:$A$2", n.getReference());
+        HSSFWorkbook b = openSample("30978-deleted.xls");
+        assertEquals(3, b.getNumberOfNames());
+        
+        // Sheet 2 is deleted
+        assertEquals("Sheet1", b.getSheetName(0));
+        assertEquals("Sheet3", b.getSheetName(1));
+        
+        Area3DPtg ptg;
+        NameRecord nr;
+        HSSFName n;
+        
+        /* ======= Name pointing to deleted sheet ====== */
+        
+        // First at low level
+        nr = b.getWorkbook().getNameRecord(0);
+        assertEquals("On2", nr.getNameText());
+        assertEquals(0, nr.getSheetNumber());
+        assertEquals(1, nr.getExternSheetNumber());
+        assertEquals(1, nr.getNameDefinition().size());
+        
+        ptg = (Area3DPtg)nr.getNameDefinition().get(0);
+        assertEquals(1, ptg.getExternSheetIndex());
+        assertEquals(0, ptg.getFirstColumn());
+        assertEquals(0, ptg.getFirstRow());
+        assertEquals(0, ptg.getLastColumn());
+        assertEquals(2, ptg.getLastRow());
+        
+        // Now at high level
+        n = b.getNameAt(0);
+        assertEquals("On2", n.getNameName());
+        assertEquals("", n.getSheetName());
+        assertEquals("#REF!$A$1:$A$3", n.getReference());
+        
+        
+        /* ======= Name pointing to 1st sheet ====== */
+        
+        // First at low level
+        nr = b.getWorkbook().getNameRecord(1);
+        assertEquals("OnOne", nr.getNameText());
+        assertEquals(0, nr.getSheetNumber());
+        assertEquals(0, nr.getExternSheetNumber());
+        assertEquals(1, nr.getNameDefinition().size());
+        
+        ptg = (Area3DPtg)nr.getNameDefinition().get(0);
+        assertEquals(0, ptg.getExternSheetIndex());
+        assertEquals(0, ptg.getFirstColumn());
+        assertEquals(2, ptg.getFirstRow());
+        assertEquals(0, ptg.getLastColumn());
+        assertEquals(3, ptg.getLastRow());
+        
+        // Now at high level
+        n = b.getNameAt(1);
+        assertEquals("OnOne", n.getNameName());
+        assertEquals("Sheet1", n.getSheetName());
+        assertEquals("Sheet1!$A$3:$A$4", n.getReference());
+        
+        
+        /* ======= Name pointing to 3rd sheet ====== */
+        
+        // First at low level
+        nr = b.getWorkbook().getNameRecord(2);
+        assertEquals("OnSheet3", nr.getNameText());
+        assertEquals(0, nr.getSheetNumber());
+        assertEquals(2, nr.getExternSheetNumber());
+        assertEquals(1, nr.getNameDefinition().size());
+        
+        ptg = (Area3DPtg)nr.getNameDefinition().get(0);
+        assertEquals(2, ptg.getExternSheetIndex());
+        assertEquals(0, ptg.getFirstColumn());
+        assertEquals(0, ptg.getFirstRow());
+        assertEquals(0, ptg.getLastColumn());
+        assertEquals(1, ptg.getLastRow());
+        
+        // Now at high level
+        n = b.getNameAt(2);
+        assertEquals("OnSheet3", n.getNameName());
+        assertEquals("Sheet3", n.getSheetName());
+        assertEquals("Sheet3!$A$1:$A$2", n.getReference());
     }
     
     /**
@@ -519,12 +519,12 @@
      * The sample file provided with bug 45582 seems to have one extra byte after the EOFRecord
      */
     public void testExtraDataAfterEOFRecord() {
-    	try {
-    		HSSFTestDataSamples.openSampleWorkbook("ex45582-22397.xls");
-    	} catch (RecordFormatException e) {
-    		if (e.getCause() instanceof LittleEndian.BufferUnderrunException) {
-    			throw new AssertionFailedError("Identified bug 45582");
-    		}
-    	}
-	}
+        try {
+            HSSFTestDataSamples.openSampleWorkbook("ex45582-22397.xls");
+        } catch (RecordFormatException e) {
+            if (e.getCause() instanceof LittleEndian.BufferUnderrunException) {
+                throw new AssertionFailedError("Identified bug 45582");
+            }
+        }
+    }
 }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java?rev=684990&r1=684989&r2=684990&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java Mon Aug 11 16:58:54 2008
@@ -17,17 +17,15 @@
 
 package org.apache.poi.hssf.usermodel;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.IOException;
 
 import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.util.AreaReference;
 import org.apache.poi.hssf.util.CellReference;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
  * 
@@ -42,10 +40,6 @@
 		return HSSFTestDataSamples.openSampleWorkbook(sampleFileName);
 	}
 
-	public static void main(String[] args) {
-		junit.textui.TestRunner.run(TestNamedRange.class);
-	}
-
 	/** Test of TestCase method, of class test.RangeTest. */
 	public void testNamedRange() {
 		HSSFWorkbook wb = openSample("Simple.xls");
@@ -411,7 +405,7 @@
 		String cellValue = "TEST Value";
 		HSSFWorkbook wb = new HSSFWorkbook();
 		HSSFSheet sheet = wb.createSheet(sheetName);
-		sheet.createRow(0).createCell((short) 0).setCellValue(cellValue);
+		sheet.createRow(0).createCell(0).setCellValue(new HSSFRichTextString(cellValue));
 		 
 		// create named range for a single cell using areareference
 		HSSFName namedCell = wb.createName();
@@ -447,7 +441,7 @@
 		String sname = "TestSheet", cname = "TestName", cvalue = "TestVal";
 		HSSFWorkbook wb = new HSSFWorkbook();
 		HSSFSheet sheet = wb.createSheet(sname);
-		sheet.createRow(0).createCell((short) 0).setCellValue(cvalue);
+		sheet.createRow(0).createCell(0).setCellValue(new HSSFRichTextString(cvalue));
 		 
 		// create named range for a single cell using cellreference
 		HSSFName namedCell = wb.createName();
@@ -492,56 +486,60 @@
 		}
    }
 	
-	public void testRepeatingRowsAndColumsNames() throws Exception {
+	public void testRepeatingRowsAndColumsNames() {
+		// First test that setting RR&C for same sheet more than once only creates a 
+		// single  Print_Titles built-in record
 		HSSFWorkbook wb = new HSSFWorkbook();
-		HSSFSheet sheet = wb.createSheet();
+		HSSFSheet sheet = wb.createSheet("FirstSheet");
 		
-		for (int rowItem = 0; rowItem < 10; rowItem++) {
-			HSSFRow r = sheet.createRow(rowItem);
-			for (int column = 0; column < 2; column++) {
-				HSSFCell cellItem = r.createCell((short) column);
-				cellItem.setCellType(HSSFCell.CELL_TYPE_STRING);
-				cellItem.setCellValue(new HSSFRichTextString("Some value here"));
-				if (rowItem == 2) {
-					wb.setRepeatingRowsAndColumns(0, 0, 0, 0, 3 - 1);
-					sheet.createFreezePane(0, 3);
-				} 
-			}
+		// set repeating rows and columns twice for the first sheet
+		for (int i = 0; i < 2; i++) {
+			wb.setRepeatingRowsAndColumns(0, 0, 0, 0, 3-1);
+			sheet.createFreezePane(0, 3);
 		}
-
-		assertEquals(2, wb.getNumberOfNames());
+		assertEquals(1, wb.getNumberOfNames());
 		HSSFName nr1 = wb.getNameAt(0);
-		HSSFName nr2 = wb.getNameAt(1);
 		
 		assertEquals("Print_Titles", nr1.getNameName());
-		assertEquals("Sheet0!$A$1:$A$0,Sheet0!$A$1:$IV$3", nr1.getReference());
-		
-		assertEquals("Excel_Name_Record_Titles_1_1", nr2.getNameName());
-		assertEquals("Sheet0!$A$1:$A$0,Sheet0!$A$1:$IV$3", nr2.getReference());
+		if (false) {
+			// 	TODO - full column references not rendering properly, absolute markers not present either
+			assertEquals("FirstSheet!$A:$A,FirstSheet!$1:$3", nr1.getReference());
+		} else {
+			assertEquals("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.getReference());
+		}
 		
 		// Save and re-open
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		wb.write(baos);
-		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-		HSSFWorkbook nwb = new HSSFWorkbook(new POIFSFileSystem(bais));
+		HSSFWorkbook nwb = HSSFTestDataSamples.writeOutAndReadBack(wb);
 
-		assertEquals(2, nwb.getNumberOfNames());
+		assertEquals(1, nwb.getNumberOfNames());
 		nr1 = nwb.getNameAt(0);
-		nr2 = nwb.getNameAt(1);
 		
-		// TODO -
-		//  should these references really have been corrected?
-		//  and if so, why not also above?
 		assertEquals("Print_Titles", nr1.getNameName());
-		assertEquals("Sheet0!A:A,Sheet0!$A$1:$IV$3", nr1.getReference());
+		assertEquals("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.getReference());
+		
+		// check that setting RR&C on a second sheet causes a new Print_Titles built-in
+		// name to be created
+		sheet = nwb.createSheet("SecondSheet");
+		nwb.setRepeatingRowsAndColumns(1, 1, 2, 0, 0);
+
+		assertEquals(2, nwb.getNumberOfNames());
+		HSSFName nr2 = nwb.getNameAt(1);
 		
-		assertEquals("Excel_Name_Record_Titles_1_1", nr2.getNameName());
-		assertEquals("Sheet0!A:A,Sheet0!$A$1:$IV$3", nr2.getReference());
+		assertEquals("Print_Titles", nr2.getNameName());
+		assertEquals("SecondSheet!B:C,SecondSheet!$A$1:$IV$1", nr2.getReference());
 		
-		// In case you fancy checking in excel, to ensure it
-		//  won't complain about the file now
-		FileOutputStream fout = new FileOutputStream(File.createTempFile("POI-45126-", ".xls"));
-		wb.write(fout);
-		fout.close();
+		if (false) {
+			// In case you fancy checking in excel, to ensure it
+			//  won't complain about the file now
+			try {
+				File tempFile = File.createTempFile("POI-45126-", ".xls");
+				FileOutputStream fout = new FileOutputStream(tempFile);
+				nwb.write(fout);
+				fout.close();
+				System.out.println("check out " + tempFile.getAbsolutePath());
+			} catch (IOException e) {
+				throw new RuntimeException(e);
+			}
+		}
 	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message