Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpreadSheet Writer is not working #43

Open
Naveen-Kumar-Reddy-Murthi opened this issue Jun 17, 2021 · 0 comments
Open

SpreadSheet Writer is not working #43

Naveen-Kumar-Reddy-Murthi opened this issue Jun 17, 2021 · 0 comments

Comments

@Naveen-Kumar-Reddy-Murthi
Copy link

Naveen-Kumar-Reddy-Murthi commented Jun 17, 2021

package org.example;

import io.github.millij.poi.ss.model.annotations.Sheet;
import io.github.millij.poi.ss.model.annotations.SheetColumn;
import io.github.millij.poi.ss.writer.SpreadsheetWriter;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;

public class App 
{
    public static void main( String[] args ) throws IOException {
        Employee employee = new Employee(1, "Naveen");
        SpreadsheetWriter spreadsheetWriter = new SpreadsheetWriter(new File("Emp.xlsx"));
        spreadsheetWriter.addSheet(Employee.class, Arrays.asList(employee),"Employee");
        spreadsheetWriter.write();

    }
}

@Sheet
 class Employee {

    @SheetColumn("Id")
    private Integer id;

    @SheetColumn("Name")
    private String name;

    public Employee(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Employee() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

This doesn't write data to an excel file. Just generates a file with headers but no data.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant