@controltec,
I have evaluated your issue a bit using your sample code (below) but I could not find any issue with the output files generated. When I open the SummaryBook.xlsx file into MS Excel 2007/2013, it does not prompt me “Security Warning…” with an Options button where I can enable the contents. I have attached the zipped archive (generated) that includes both the files. I am using the following sample code to generate the files to be included into the zipped archive (report2.zip (attached)):
e.g
Sample code:
import com.aspose.cells.*;
import java.awt.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class test1 {
public static void main(String[] args) {
// set the aspose license
License license = new License();
//license.setLicense("Aspose.Cells.lic");
Workbook detailBook = generateDetailWorkbook();
try {
File file = new File("f:/Files/report2.zip");
FileOutputStream fop = new FileOutputStream(file);
ZipOutputStream zipStream = new ZipOutputStream(fop);
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] data;
detailBook.save(out, SaveFormat.XLSX);
data = out.toByteArray();
zipStream.putNextEntry(new ZipEntry("DetailBook.xlsx"));
zipStream.write(data);
zipStream.closeEntry();
Workbook summaryBook = generateSummaryWorkbook(detailBook);
summaryBook.getSettings().setUpdateLinksType(UpdateLinksType.NEVER);
out = new ByteArrayOutputStream();
summaryBook.save(out, SaveFormat.XLSX);
data = out.toByteArray();
zipStream.putNextEntry(new ZipEntry("SummaryBook.xlsx"));
zipStream.write(data);
zipStream.closeEntry();
zipStream.close();
fop.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private static Workbook generateDetailWorkbook() {
Workbook workbook = new Workbook(FileFormatType.XLSX);
workbook.setFileName("DetailBook.xlsx");
Worksheet worksheet = workbook.getWorksheets().get(0);
worksheet.setName("Info");
Cell cell = worksheet.getCells().get(0, 0);
cell.setValue("TimeStamp");
cell = worksheet.getCells().get(0, 1);
cell.setValue("Parameter Value");
return workbook;
}
private static Workbook generateSummaryWorkbook(Workbook detailBook) {
Workbook workbook = new Workbook(FileFormatType.XLSX);
workbook.setFileName("SummaryBook.xlsx");
Worksheet worksheet = workbook.getWorksheets().get(0);
worksheet.setName("Summary");
Cell cell = worksheet.getCells().get(0, 0);
cell.setFormula("[DetailBook.xlsx]Info!A2");
worksheet.getHyperlinks().add(cell.getName(), 1, 1, "DetailBook.xlsx");
return workbook;
}
}
Could you give us more details if I understand your issue or I am missing something? You may also attach some screenshots taken in MS Excel manually to highlight the issue.
report2.zip (13.0 KB)
Thank you.