Hi,
I am trying to combine two workbooks which have conditional formatting. Formatting gets lost when doing workbook.combine().
Sample File: ConditionalFormattingIssue.xls
Output File: outputWithAspose.xls
Conditional Formatting Snapshot: formatting.jpg
Please let me know if you require any further details
Thanks
Dheena
Sample Code:
/*
* File : $Source: $
* Version : $Revision: $
* Date : $Date: $
* Modified by : $Author: $
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.aspose.cells.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class TestAspose
{
static String wd = "C:\\Developer\\TEMP\\frame\\";
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception
{
File file = new File("C:\\Developer\\TEMP\\frame\\");
File[] inputFiles = file.listFiles();
License license = new License();
license.setLicense(new FileInputStream("C:\\Developer\\work\\workspace\\TestAspose\\lib\\Aspose.Cells.lic"));
Workbook outputWorkbook = new Workbook();
for (File inputFile : inputFiles)
{
if (!inputFile.getAbsolutePath().equalsIgnoreCase("C:\\Developer\\TEMP\\frame\\master_blank.xls"))
{
Workbook book = new Workbook();
book.open(inputFile.getAbsolutePath());
Worksheets sheets = book.getWorksheets();
Worksheet sheet = sheets.getSheet(0);
sheet.setName("Test");
outputWorkbook.combine(book);
}
}
String fileName = wd + "outputWithAspose.xls";
outputWorkbook.save(fileName, FileFormatType.EXCEL97TO2003);
}
}