2

i've created an application for converting json to excel , The code works fine but nothing is writing into excel sheet generated. can anyone please tell me the reason for this.

jxl library for excel convertion

My code is given below

 public static void majin(String[] args) throws Exception
        {   

            WritableWorkbook wworkbook;
            wworkbook = Workbook.createWorkbook(new File("C:/SWD.csv"));
            WritableSheet wsheet = wworkbook.createSheet("SWD", 0);

            WritableFont cellFont = new WritableFont(WritableFont.TIMES, 12);
            cellFont.setColour(Colour.BLACK);
            WritableCellFormat cellFormat = new WritableCellFormat(cellFont);

            cellFormat.setBackground(Colour.WHITE); 
            cellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
            Label label = new Label(0, 0,"mydata",cellFormat);
            wsheet.setColumnView(0, 18);
            wsheet.addCell(label); 

        }
1
  • guide me how to get my json data into excel Commented Dec 19, 2016 at 7:59

1 Answer 1

1

I guess you have missed following line to write data to excel file:

wsheet.write();

And you can close the file after writing data into file like:

wsheet.close();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.