You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2006/12/28 05:28:05 UTC

DO NOT REPLY [Bug 41248] New: - Import into Access Fails

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41248>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41248

           Summary: Import into Access Fails
           Product: POI
           Version: 2.5
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: barlock@us.ibm.com


I have the following test program that generates an XLS file with two 
columns.  If I try to import this XLS into Microsoft Access 2003 (File > 
Get External Data > Import) only the first column shows in the Access 
dialog listing the data to be imported.  If I change the XLS to have three 
columns, all three show up!  Also, if I open the generated XLS file and save 
it, it imports into Access without error.  

Is this a bug in my program, or a bug in the HSSF classes? (I posted to the 
POI users mailing list, but no response.)

import java.io.FileOutputStream;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class Test2 {
    public static void main(String[] args) throws Exception {
        final String[] header = { 
            "a",
            "b",
            //"b", "c"
        };
 
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("Sheet 1");
        HSSFRow row;
        HSSFCell cell; 
        HSSFWorkbook hssfwb = new HSSFWorkbook();

        // Write the header.
        row = sheet.createRow(0);
        for (short j = 0; j < header.length; j++) {
            row.createCell(j).setCellValue(header[j]);
        }

        // Write a row of data.
        short k = 0;
        row = sheet.createRow(1);
        cell = row.createCell(k++);
        cell.setCellValue("a_value");
        cell = row.createCell(k++);
        cell.setCellValue("b_value");
        //cell = row.createCell(k++);
        //cell.setCellValue("c_value");
 
        String outputFileName = "test.xls";
        FileOutputStream fos = new FileOutputStream(outputFileName);
        wb.write(fos);
        fos.close();
    }
}

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


DO NOT REPLY [Bug 41248] - Import into Access Fails

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41248>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41248





------- Additional Comments From avik@apache.org  2007-01-03 06:24 -------
Given that there is no spec, different implementations will have different
interpretations of what's required for a valid file. Our effort has been to
ensure that files created by POI get read correctly in Excel. And vice versa. I
guess that supporting other implementations of the format will be too difficult
a task for the current dev team. If someone can however, debug this and say
which records are causing the problem, it might get a fix.  

Sorry, just trying to be realistic. 

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

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/