After making a workbook that has links to other workbooks, I want to always ignore links and not prompt the user. I see that you have a nice WorkbookSettings method called “setUpdateLinksType” that we can set using the UpdateLinksType class. After setting the type to NEVER I am still getting prompted when opening the workbook.
Please try our latest version/fix: Aspose.Cells for .NET v17.6.5:
I have tested your scenario/case a bit using my simple template file (which has some external links in it) with the following sample code using v17.6.5, it works fine and I do not get any prompt (by MS Excel) now.
e.g Sample code:
Workbook workbook = new Workbook("Book1.xlsx");
workbook.getSettings().setUpdateLinksType(UpdateLinksType.NEVER);
workbook.save("f:\\files\\out1.xlsx");
If you still find the issue with v17.6.5, kindly provide us your template file, sample code and output file here, we will check it soon.
I am afraid, I could not evaluate your issue properly as you did not share the “report.zip” file used in your code. We also appreciate if you could simplify the code and use a few lines of code (if possible) with sample file(s), etc. to reproduce the issue on our end, it will help us really to analyse your issue efficiently and to log into our database for a fix.
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.