Try to create a simple file, make the file as simple as posible, with no formatting in cells and simple strings (no RichTextString).
I'm afraid that I cannot help you so much since I don't have neither Office 2007 not Statistica, but let me know if the no styled file works. Regards. On Thu, Nov 25, 2010 at 5:20 AM, Paal Larsen <[email protected]> wrote: > > Column widths was more for my own sake too look for errors when moving data > before importing to the other program so I tried again after removing all of > them. But I got the same result. > Also tried not putting dates into the file in case some errors there. But > still same error. The rest of the data is text and small numbers. > > The program is http://www.statsoft.com/products/desktop-solutions/ . > Here is a picture of the program > http://www.statsoft.no/images/stories/produktbilder/statistica_base.png . > It's still a spreadsheet after converting, but the first row is changed etc. > > Since the import fails and says no data I'm guessing it cannot read one/some > of the cells? > > > >> Subject: Re: Import fails when using files made with POI. >> From: [email protected] >> Date: Wed, 24 Nov 2010 13:34:32 -0800 >> To: [email protected] >> >> Try setting your column widths after the indPerson loop. >> >> If that fails then please tell us more about the program that takes Excel >> files, it might be good to know what technology was used. >> >> Regards, >> Dave >> >> On Nov 24, 2010, at 1:25 PM, Paal Larsen wrote: >> >> > >> > I have two programs (not made by me), one which gives text files as output >> > and one that takes excel files as input. Using POI I take the data I want >> > from the text files and put it in excel files. When I open the excel file >> > in Excel 2007 everything looks ok. However I get an error message when >> > trying to import the made excel file through the other program. It's not >> > an error in the program, manually made files works fine. (The error >> > message says "Import fail: No data in file." But this text is probably >> > just poorly made exception handling.) >> > >> > Also if I open the excel file made with POI, write something random in a >> > random cell, save the file, and then delete the content of that cell and >> > save it again, the program imports the file without problems. >> > >> > I also noticed that although none of the cells are changed at all the file >> > size increases by 57% when I edit and save it like mentioned above. Since >> > I can open the file in excel I'm guessing there is no bugs in my code? But >> > if no bugs I don't understand what the problem is. Is there another way to >> > make the file or save the data in it which fixes this problem? Below is >> > one of the methods that makes an excel file: >> > >> > >> > >> > private void makeFile(Persons persons) { >> > int maxTests = HelperClass.maxTests(persons,testName); >> > Workbook wb = new XSSFWorkbook(); >> > CreationHelper createHelper = wb.getCreationHelper(); >> > Sheet sheet = wb.createSheet(); >> > Row row = sheet.createRow(0); >> > //Make the headers >> > sheet.setColumnWidth(0, 6000); >> > row.createCell(0).setCellValue( >> > createHelper.createRichTextString("Resultat Treisman Formes")); >> > sheet.setColumnWidth(1, 4000); >> > row.createCell(1).setCellValue( >> > createHelper.createRichTextString("Kodenummer")); >> > sheet.setColumnWidth(2, 4000); >> > row.createCell(2).setCellValue( >> > createHelper.createRichTextString("Vakter")); >> > for(int i=0;i<maxTests;i++){ >> > sheet.setColumnWidth(3+i*numInfo, 3000); >> > row.createCell(3+numInfo*i).setCellValue( >> > createHelper.createRichTextString("Dato")); >> > sheet.setColumnWidth(4+i*numInfo, 3000); >> > row.createCell(4+numInfo*i).setCellValue( >> > createHelper.createRichTextString("Ant riktig")); >> > sheet.setColumnWidth(5+i*numInfo, 3000); >> > row.createCell(5+numInfo*i).setCellValue( >> > createHelper.createRichTextString("Ant feil")); >> > } >> > >> > Person[] personArray = persons.getPersons(); >> > //add tests from all persons >> > for(int indPerson=0;indPerson<personArray.length;indPerson++){ >> > Row tempRow = sheet.createRow(indPerson+1); >> > >> > //first and third column empty >> > >> > //add name >> > tempRow.createCell(1).setCellValue( >> > createHelper.createRichTextString( >> > personArray[indPerson].getName())); >> > Test[] sortedTests = personArray[indPerson].getTests(testName); >> > //for each test >> > if(sortedTests!=null) { >> > for(int indTest=0;indTest<sortedTests.length;indTest++){ >> > >> > //add date >> > Cell cell = tempRow.createCell(3+numInfo*indTest); >> > >> > cell.setCellValue( >> > createHelper.createRichTextString( >> > sortedTests[indTest].getDate())); >> > >> > //add all values in a test >> > Hashtable<String,String[]> info = sortedTests[indTest].getInfo(); >> > String[] values = info.get(HelperClass.resTreismanF); >> > >> > if(values!=null) { >> > for(int i=0;i<values.length;i++){ >> > tempRow.createCell(4+numInfo*indTest+i).setCellValue( >> > Double.parseDouble(values[i])); >> > } >> > } >> > } >> > } >> > } >> > //Write the output to a file and close the connection. >> > FileOutputStream fileOut = null; >> > try { >> > fileOut = new FileOutputStream(outputName); >> > wb.write(fileOut); >> > fileOut.close(); >> > } catch (FileNotFoundException fnfe) { >> > //...deleted >> > } >> > } catch (IOException iie) { >> > //...deleted >> > } >> > } >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > -- ちりも積もれば山となる --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
