Is there any way for me to read a template xls file, and add some informations on it, like color of cell, width of columns and than I generate the file to export?
I tried to read a template file at preProcessor method, but at postProcessor my cells are not like the template. Is there any way for me to do that?
Tks,
Thiago Teixeira
Reading a Template Xls Before Writing Data
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
The only way to manipulate the xls export is to use the processor hooks, as an example following is the way to change the cell colors;
http://97.107.138.40:8080/prime-showcas ... cessor.jsf
http://97.107.138.40:8080/prime-showcas ... cessor.jsf
I made my example based on this case, but I want to do is to read the color informations from a template and put these informations in the xls file i`m writing.
For example, if I have 2 templates file, one with all cell with green background and the other template with blue background.
I want to read one of the template files and put the color information under my new file. Only for test purpose I did something like this, and it`s not working, do you now why?
The sheet is being created, but all cells are empty.
Tks,
Thiago Teixeira
For example, if I have 2 templates file, one with all cell with green background and the other template with blue background.
I want to read one of the template files and put the color information under my new file. Only for test purpose I did something like this, and it`s not working, do you now why?
Code: Select all
public void preProcessXLS(Object document) throws IOException {
HSSFWorkbook wb = (HSSFWorkbook) document;
HSSFSheet sheet = wb.createSheet();
InputStream in = new FileInputStream(new File("c:\\template.xls"));
HSSFWorkbook workbook = new HSSFWorkbook(in);
sheet = workbook.getSheetAt(0);
}
Tks,
Thiago Teixeira
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Your preprocessor creates a new excel ignoring the one excelexporter creates so that will not work. What you can do is read your template, extract color information from that if you can and copy that template information to the exported document.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 22 guests