Free Support Forum - aspose.com

I don't want a client can save file on his computer


Hi,

i’m testing the Aspose.Excel and it seem to be a great product. But there is one thing that i like to do and I didn’t find how to do.

My goal is… I don’t want that any person who use my XLS file (by Aspose.Excel), can save the file on his computer.

For that, i’ve removed the menu in IE. But when exiting the IE window, a popup SaveDocument appear.

- The document has been modofied. Do you want to save your changes? -

Can I remove this option or do you have a workaround to reach my goal.

Thanks for your help.


Erik

Hi Erik,

If the user can view your XLS file in his computer, he can save the file on his machine. Aspose.Excel works on the server side and cannot limit the action on the client side. Maybe you can try this workaround:
1. Insert some VBA code in your designer file.
2. When user choose to save the file, the VBA code will run to remove all contents.

But I don’t think it’s an elegant solution because VBA code may seem to be virus. So why do you want to forbid your users to save file while they can view it?

Thanks Laurence for your answer.

We have about 20 sheets we use to help us to take some decisions about different civil engineering project. The goal is that our employees can use this sheets and print the results while they work for us. But if they leave, we want to remove his rights to use the it. That’s why we don’t want that the client can save the file on his computer.

Other question… (Here 3 SAVE methods)

Creates the result spreadsheet to the memory stream.
public void Save(string,FileFormatType,out MemoryStream);

Creates the result spreadsheet and transfer it to the client then open it in the browser.
public void Save(string,SaveType,FileFormatType,HttpResponse);

Creates and saves the result spreadsheet to the disk.
public void Save(string,FileFormatType);

Presently I use the second SAVE method. But i’d like to know the difference between the first and the second method. Can you give me an example of the use of the MemoryStream.

Thanks in advance !!!

Erik

Hi Erik,

Since your users can use the sheet and print the result, currently there is not a solution to forbid them to save the file. You can limit the file content and remove the right to access your web site while they don’t work for you.

The second method directly save the result file to client browser. After saving to client, the content in the Excel object is cleared.

The first method save the file to memory stream. You can repeatedly retrieve data from the memory and use it as your wish.

excel.Save(“result.xls”, FileFormatType.Default, memoryStream);
byte[] data = memoryStream.ToArray();

You can repeatedly use the data bytes array. For example, you can repeatedly save a file to different users, save several copys to the disk or create an excel file in memory and send it as an attachment to an email .