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)
We have attached two Excel files (download link given below)
s1.xlsx
s2.xlsx
Please try these files with our given sample code in your environment and let us know your feedback. This will help us isolate the issue if it is related to your environment or related to your specific Excel files. Besides, we tested your issue in Excel 2007 and it also did not replicate the issue.
I am afraid, I am not able to download your image. Could you re-attach it or provide it to me via dropbox. It is strange, I am a moderator but when I download your file, it gives me this error
File: Screen Shot 2017-07-12 at 7.56.35 AM.png (25.5 KB)
Sorry, this file is private. Only visible to post creator and staff members.
We have looked into this issue and found that it should be a behavior of Excel 2008 for Mac.
Please create a file with external links and the file could be opened without warning message box in Excel 2008 for Mac. If you can create such a file, then provide it to us. We will look into this issue more.
here is the files again. SummaryBook has links to DetailBook. When opening SummaryBook I am receive the prompt even though i have setUpdateLinks to NEVER. report.zip (11.8 KB)
That’s my whole problem… If I could make a file like that I wouldn’t have ever made this post. I am setting UpdateLinks to NEVER and it is still giving me the prompt.
public static final int NEVER
Do not update, and do not prompt user.