https://issues.apache.org/bugzilla/show_bug.cgi?id=47862

           Summary: Not setting the correct columnwidth in XSSFSheet
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=24284)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24284)
Preformatted spreadsheet

I have a spreadsheet that is already preformatted. If you have consecutive
columns with the same column width and you want to change just one of those
column's width.  When you do it changes all the columns to that width.

I will attach a spreadsheet and a test program to illustrate the problem.

import java.io.*;

import org.apache.poi.ss.usermodel.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
import java.util.*;
public class Width_test {

    /**
     * @param args
     */
    public static void main(String[] args) {
        try {

        Workbook wb = new XSSFWorkbook("checkwidth3.xlsx");
        Sheet sheet = wb.getSheetAt(0);

        for (int i=5; i > -1;i--){
            System.out.println("Column: " + i + " width: " +
sheet.getColumnWidth(i));
            sheet.setColumnWidth(i, sheet.getColumnWidth(i)-1000);
            System.out.println("Column: " + i + " width: " +
sheet.getColumnWidth(i));
        }

        FileOutputStream fileOut = new FileOutputStream("checkwidth2.xlsx");
        wb.write(fileOut);
        fileOut.close();
        } catch (Exception e) {
        }
    }
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to