We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Cells issue from A M Best

Hi,

We use Aspose.Cells version 7.3.1.4. We also recently upgraded to Windows 7. After that, all Excel files generated using Aspose are opening with the message "Protected View. This file was opened from a potentially unsafe location." message in yellow on top. How can this be avoided?

Thanks,

Radhika Parthasarathy.

Project Leader - Product Application Services Ambest Road, Oldwick, NJ, 08858, USA


This message was posted using Email2Forum by Amjad Sahi.
Hi,

Kindly use our latest version/fix: Aspose.Cells for .NET v7.3.4.3 and let us know your feedback.

If it does not fix it, then we will need your simple runnable sample code to reproduce such files, also attach the sample files and screen shot to highlight the issue. We will check your issue soon.

Thank you.
Hi,

RPK:

As mentioned before, I can follow the thread you created, but I am unable to Post/Reply to it from our company.

I downloaded Aspose Version 7.3.4.3 and still have the same problem.

This is the message I get -

(Embedded image moved to file: pic29314.gif)

And here is my sample code in a Visual Studio 2010 Web Application -

(See attached file: Aspose_Test_2010.zip) Please let me know if you need anything else.


I have received your project with screen shot.


After checking your project a bit, I can notice one significant issue with your code. Please change your line of code i.e..,

AspWorkbook.Save(Me.Response, "CCRReport.xlsx", ContentDisposition.Attachment, New XlsSaveOptions(FileFormatType.Xlsx))

to:

AspWorkbook.Save(Me.Response, "CCRReport.xlsx", ContentDisposition.Attachment, New OoxmlSaveOptions(SaveFormat.Xlsx))


and let us know if it works fine now, the generated file should open file into Excel 2010.


Thank you.

Hi,

RPK:

I am not sure what OoxmlSaveOptions in your code is supposed to represent.

But I changed my code to the following -

AspWorkbook.Save(Me.Response, "CCRReport.xlsx", ContentDisposition.Attachment, New XlsSaveOptions(SaveFormat.Xlsx))

I still have the same issue.

Thanks.


Well, OoxmlSaveOptions are used to specify the Excel 2007/2010 (Open XML) file formats (e.g XLSX, XLSM etc.). I requested you to kindly change the line to:

AspWorkbook.Save(Me.Response, "CCRReport.xlsx", ContentDisposition.Attachment, New OoxmlSaveOptions(SaveFormat.Xlsx))

and let us know the result.


Thank you.

Hi,

RPK:

I get the same error when I use OoxmlSaveOptions as well.

I would also like to add that even if I create a XLS file like this -

AspWorkbook.Save(Me.Response, "CCRReport.xls", ContentDisposition.Attachment, New XlsSaveOptions) I have the same issue.

However, we have an older application using Aspose.Excel.dll Version 3.4.4.0. The code here is like this - excelReportObject.Save("CCRData.xls", SaveType.OpenInBrowser, FileFormatType.Default, Me.Response)

This XLS file opens in a "Compatibility Mode" and we do not get the Protected View message here.

I know this is a very old version, but I just wanted to explain the different behavior to you.


In that case, could you change your ContentDisposition accordingly. e.g Please use:

ContentDisposition.Inline instead of ContentDisposition.Attachment

if it works fine for your environments.

Thank you.

Hi,

Changing to ContentDisposition.Inline does get rid of the Protected View message. However, once the Aspose Save method is called, we get a dialog asking if the file should be opened or saved and when we click Open, the page load runs 3 more times before the spreadsheet actually displays. This will cause a big performance issue for our actual applications which do a lot of data processing. Can you explain how this can be avoided?


Well, well the Workbook.Save() overloads involving Response object is nothing but equivalent to:

e.g

[C#]

//................

workbook.Save(stream, new OoxmlSaveOptions(SaveFormat.Xlsx));

//Send the stream back to the client

this.Response.AddHeader("Content-Type", "application/xlsx");

this.Response.AddHeader("Content-Disposition", "inline; filename=Report.xlsx");

this.Response.BinaryWrite(ms.ToArray());

We do not do anything different than above. You may even Replace the Workbook.Save() method with the above lines.

Well, we do not find your issue at all ("PageLoad runs 3 more times... etc."), it might be due to your own project's structure or codes etc. By the way, you may try to add a line to your code (if it works fine) after Workbook.Save() or Response.BinaryWrite() method:

Response.End()


I would also like to understand what the difference between ContentDisposition Inline and Attachment is with respect to Aspose.Cells.


There is nothing special between Inline and Attachment. Inline refers to OpenInBrowser and Attachment may refer to OpenInExcel options.

See the document for your complete reference on Workbook.Save() method's options:

http://www.aspose.com/docs/display/cellsnet/Saving+Files



In short, we do not find the issue whether we use Attachment or Inline option, if you still could not evaluate, please create a sample project and attach it here to reproduce the issue on our end. If possible, please do not post your attachments via using emails, you may either attach your attachments here or even use some free drives e.g skydrive (you may upload there) to share the links here for everybody's review.


Thank you.