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 2017/01/21 10:34:31 UTC

[Bug 60184] Saved file that uses a XSSFFont without a specifically set FontFamily won't open in Excel

https://bz.apache.org/bugzilla/show_bug.cgi?id=60184

--- Comment #7 from ps26oct@gmail.com ---
I obtained poi src from git read only repo and built it accordingly. Using MS
Excel 2016 (with a MS office home subscription, which expired recently but
doesn't restrict much of the functionality of excel 2016 that I needed for
trying to reproduce the error), I was unable to reproduce the issue. Here's the
code which I used:

import java.io.*;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class bz60184 {

        public static void main(String[] args) throws IOException,
InvalidFormatException {

                File f = new File("file.xlsx"); //already created with excel in
the user.dir

                XSSFWorkbook wb = new XSSFWorkbook(f);
                XSSFCellStyle styl  = wb.createCellStyle();
                XSSFFont font = wb.createFont();
                styl.setFont(font);
                wb.getSheetAt(0).getRow(0).getCell(0).setCellStyle(styl);
                File f2 = new File("save.xlsx");
                if(f2.exists())
                        f2.delete();

                FileOutputStream os = new FileOutputStream(f2);
                wb.write(os);
                wb.close();
                os.close();
                System.out.println("DONE");

        }

}


//OS - WIN 10 ; JDK - jdk_8u102

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org