miachm/SODS

The character type cannot be output.

tarian1995 opened this issue · 6 comments

The character type cannot be output.
e.g.

public static void main(String[] args) throws Exception{
        SpreadSheet spreadSheet = new SpreadSheet();
        String projectPath = System.getProperty("user.dir");
        int rows = 3;
        int columns = 3;
        Sheet sheet = new Sheet("A", rows, columns);
        Range range = sheet.getRange(1, 1);
        range.setValue("ABC");
        spreadSheet.appendSheet(sheet);
        File file = new File(projectPath + "/src/main/resources/file/test2.ods");
        if (!file.exists()) {
            file.createNewFile();
        }
        spreadSheet.save(file);
    }

Is the string type not supported?

I am sorry, I don't know how to reproduce this issue.

May I have the ods file?

My ods file is generated directly through Java IO. I changed the number to characters based on your demo and found that the output file was empty. Yours DEMO

 public static void main(String args[]){
        try {
            int rows = 3;
            int columns = 3;
            Sheet sheet = new Sheet("A", rows, columns);

            sheet.getDataRange().setValues("A","B","C","A","B","C","A","B","C");

            // Set the underline style in the (3,3) cell
            sheet.getRange(2,2).setFontUnderline(true);

            // Set a bold font to the first 2x2 grid
            sheet.getRange(0,0,2,2).setFontBold(true);

            SpreadSheet spread = new SpreadSheet();
            spread.appendSheet(sheet);
            spread.save(new File("Out.ods"));
        } catch (IOException e){
            e.printStackTrace();
        }
    }

Maybe I'm using it in a way that's wrong?

Thank you very much for your answer.
Greetings

It works great for me... Which version are you using?

This problem[The character type cannot be output. #25] occurs when you open it with Excel

This problem[The character type cannot be output. #25] occurs when you open it with Excel

For excel, you would better to use Apache POI.

It seems this should be solved with the new 1.5.1