views:

42

answers:

1

I am working with WinForms, using C# and .Net 3.5:

I have ReportViewer exporting to PDF and Excel. However I do not want the user modifing the Excel file after it has been exported. Does anyone know how to cause the basic functionality of the export to excel to lock the file down or to export it as an image into Excel?

I have read This Stackoverflow post however can't figure out how to force a readonly state.

+1  A: 

Ok so to start,, Anything is possible with enough effort in programming.That being said, the only way I can think of to do this would be to:

1. In the code behind have the reportViewer control render the report to excel in a byte array, then feed that byte array to a 3rd party Excel control that could set a password or write protect the workbook, then send that down as the response stream.. A lot of work, yes.

2. Replace or override the reportViewer export excel functionality and re-write a custom excel parser/genration method similar to what was described in your referenced SO post. yikes.

The most logical path on this by far would probably be to educate the client about this particular 'requirement' and what it would mean in terms of development time.

Tj Kellie