UpdateLinksType doesn't work - JAVA

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.

summaryBook.getSettings().setUpdateLinksType(UpdateLinksType.NEVER);

@controltec,

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.

Thank you.

Still seeing the issue after updating to the given aspose jar test_java.zip (2.3 KB)

@controltec,

Thanks for the sample JAVA program.

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.

Thank you.

sorry, here’s a simplified program and the zip it generates

test_java.zip (965 Bytes)

report.zip (11.8 KB)

@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.

Ok, more details: I am on a mac and using Excel 2008.
Also I can’t download your report2.zip, your website says it can’t handle the request

@controltec,

Thanks for using Aspose APIs.

By security prompt, do you mean this triangle or parallelogram as shown in this image. Let us know your feedback.

I mean this warning you get when opening the workbook Screen Shot 2017-07-10 at 3.12.44 PM.png (27.4 KB)

Also this code seems to work for Excel 2013 or higher on windows.

@controltec

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.

Java

Workbook wb = new Workbook(dirPath + "s2.xlsx");

wb.getSettings().setUpdateLinksType(UpdateLinksType.NEVER);

wb.save(dirPath + "out.xlsx");

s1 s2.zip (11.6 KB)

I cannot download your attached zip. your website won’t let me

@controltec,

We are sorry for the inconvenience. Hopefully, you can download it from dropbox link given below.

@controltec,

Please make sure you have logged in Aspose site first and then open the thread and try to download the attachment (we attached) if it works fine.

Let us know if you still find the issue with downloading the attachments.

Thank you.

I still got this Screen Shot 2017-07-12 at 7.56.35 AM.png (25.5 KB) when trying to open your s2 file.

The dropbox works, but even when logged in the original download links do not work. Please keep using dropbox if you need to send more files.

@controltec

Please provide us feedback about this post. Thank you.

I still got this Screen Shot 2017-07-12 at 7.56.35 AM.png (25.5 KB) when trying to open your s2 file.

I did.

@controltec

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.

It’s exactly the same image i shared a while back. here’s a re-upload Screen Shot 2017-07-12 at 7.56.35 AM.png (25.5 KB)

@controltec

Thanks for your feedback and using Aspose APIs.

Since, this issue is not related to some specific files but related to Excel 2008 for Mac alone, so we have logged it in our database for a fix.

This issue has been logged as

  • CELLSJAVA-42344 - UpdateLinksType property does not work for Excel 2008 for Mac