You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2009/02/25 20:12:53 UTC

svn commit: r747895 - in /poi/trunk/src: documentation/content/xdocs/changes.xml documentation/content/xdocs/status.xml ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java

Author: yegor
Date: Wed Feb 25 19:12:53 2009
New Revision: 747895

URL: http://svn.apache.org/viewvc?rev=747895&view=rev
Log:
fixed bug #46715 -  Column width from original xlsx file is discarded

Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java

Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=747895&r1=747894&r2=747895&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Wed Feb 25 19:12:53 2009
@@ -37,12 +37,14 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.5-beta6" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">46719 - fixed XSSFSheet.shiftRows to correctly preserve row heights</action>
+           <action dev="POI-DEVELOPERS" type="fix">46715 - preserve custom column widths across re-serialization of XSSFWorkbook</action>
            <action dev="POI-DEVELOPERS" type="add">46703 - added setDisplayZeros / isDisplayZeros to common interface org.apache.poi.ss.usermodel.Sheet</action>
            <action dev="POI-DEVELOPERS" type="add">46708 - added getMergedRegion(int) to common interface org.apache.poi.ss.usermodel.Sheet</action>
            <action dev="POI-DEVELOPERS" type="fix">fixed Sheet.autoSizeColumn() to use cached formula values when processing formula cells </action>
            <action dev="POI-DEVELOPERS" type="fix">Fixed formula parser to handle names with backslashes</action>
            <action dev="POI-DEVELOPERS" type="add">46660 - added Workbook getHidden() and setHidden(boolean)</action>
-           <action dev="POI-DEVELOPERS" type="fix">46693 - Fixed bugs serialization bugs in records: CHARTFORMAT, SHTPROPS, SXVD and SXVDEX</action>
+           <action dev="POI-DEVELOPERS" type="fix">46693 - Fixed serialization bugs in records: CHARTFORMAT, SHTPROPS, SXVD and SXVDEX</action>
            <action dev="POI-DEVELOPERS" type="fix">46627 - Fixed offset of added images if Pictures stream contains pictures with zero length</action>
         </release>
         <release version="3.5-beta5" date="2009-02-19">

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=747895&r1=747894&r2=747895&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Wed Feb 25 19:12:53 2009
@@ -34,6 +34,8 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.5-beta6" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">46719 - fixed XSSFSheet.shiftRows to correctly preserve row heights</action>
+           <action dev="POI-DEVELOPERS" type="fix">46715 - preserve custom column widths across re-serialization of XSSFWorkbook</action>
            <action dev="POI-DEVELOPERS" type="add">46703 - added setDisplayZeros / isDisplayZeros to common interface org.apache.poi.ss.usermodel.Sheet</action>
            <action dev="POI-DEVELOPERS" type="add">46708 - added getMergedRegion(int) to common interface org.apache.poi.ss.usermodel.Sheet</action>
            <action dev="POI-DEVELOPERS" type="fix">fixed Sheet.autoSizeColumn() to use cached formula values when processing formula cells </action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java?rev=747895&r1=747894&r2=747895&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java Wed Feb 25 19:12:53 2009
@@ -425,54 +425,4 @@
         }
         setRowNum(rownum);
     }
-
-    protected void updateFormulasAfterCellShift(FormulaShifter shifter) {
-        for(Cell c : this){
-            XSSFCell cell = (XSSFCell)c;
-
-            CTCell ctCell = cell.getCTCell();
-            if(ctCell.isSetF()){
-                CTCellFormula f = ctCell.getF();
-                String formula = f.getStringValue();
-                if(formula.length() > 0) {
-                    String shiftedFormula = shiftFormula(formula, shifter);
-                    if (shiftedFormula != null) {
-                        f.setStringValue(shiftedFormula);
-                    }
-                }
-
-                if(f.isSetRef()){ //Range of cells which the formula applies to.
-                    String ref = f.getRef();
-                    String shiftedRef = shiftFormula(ref, shifter);
-                    if(shiftedRef != null) f.setRef(shiftedRef);
-                }
-            }
-
-        }
-    }
-
-    /**
-     * Shift a formula by the specified number of rows
-     * <p>
-     * Example: shiftFormula("A1+B1+C1", 3) will return "A4+B4+C4"
-     * </p>
-     *
-     * @param formula the formula to shift
-     * @param shifter the FormulaShifter object that operates on the parsed formula tokens
-     * @return the shifted formula if the formula was changed,
-     *   <code>null</code> if the formula wasn't modified
-     */
-    private String shiftFormula(String formula, FormulaShifter shifter){
-        XSSFSheet sheet = getSheet();
-        XSSFWorkbook wb = sheet.getWorkbook();
-        int sheetIndex = wb.getSheetIndex(sheet);
-        XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(wb);
-        Ptg[] ptgs = FormulaParser.parse(formula, fpb, FormulaType.CELL, sheetIndex);
-        String shiftedFmla = null;
-        if (shifter.adjustFormula(ptgs, sheetIndex)) {
-            shiftedFmla = FormulaRenderer.toFormulaString(fpb, ptgs);
-        }
-        return shiftedFmla;
-    }
-
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java?rev=747895&r1=747894&r2=747895&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java Wed Feb 25 19:12:53 2009
@@ -219,13 +219,14 @@
     }
 
     public void setColumnAttributes(CTCol fromCol, CTCol toCol) {
-    	toCol.setWidth(fromCol.getWidth());
-    	toCol.setHidden(fromCol.getHidden());
-    	toCol.setBestFit(fromCol.getBestFit());
-        toCol.setStyle(fromCol.getStyle());
-        if(fromCol.getOutlineLevel()!=0){
-        	toCol.setOutlineLevel(fromCol.getOutlineLevel());
-        }
+    	if(fromCol.isSetBestFit()) toCol.setBestFit(fromCol.getBestFit());
+        if(fromCol.isSetCustomWidth()) toCol.setCustomWidth(fromCol.getCustomWidth());
+        if(fromCol.isSetHidden()) toCol.setHidden(fromCol.getHidden());
+        if(fromCol.isSetStyle()) toCol.setStyle(fromCol.getStyle());
+        if(fromCol.isSetWidth()) toCol.setWidth(fromCol.getWidth());
+        if(fromCol.isSetCollapsed()) toCol.setCollapsed(fromCol.getCollapsed());
+        if(fromCol.isSetPhonetic()) toCol.setPhonetic(fromCol.getPhonetic());
+        if(fromCol.isSetOutlineLevel()) toCol.setOutlineLevel(fromCol.getOutlineLevel());
     }
 
     public void setColBestFit(long index, boolean bestFit) {



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