How will I export report into Word Doc and set it to a READ-ONLY file

xyberfrend
xyberfrend used Ask the Experts™
on
I need to set the Settings of the report I
am exporting into Wor Dodument format into a
READ-ONLY file in ASP. Is there a property
that I can use with the obj.ExportOptions to
set this requirement I need.

The code that I have right now is this

Set objExportOptions =
objReport.ExportOptions
objExportOptions.DiskFileName =
Server.MapPath
("../../../../Reports/Results/Payslip")
&"\"& objXMLParams.ChildNodes(0).ChildNodes
(2).text & ".doc"
objExportOptions.FormatType =
14 `Word Docu
objExportOptions.DestinationType = 1

What propert should I use in the object ExportOptions to set the said requirements.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
I assume the export is working and you only need to set file attributes on the word document?

Is the document being opened by the export or is the document for later viewing?

mlmcc


Author

Commented:
Regarding the follow up question of mlmcc

The export is already working.
My problem is after that, how will I be able to set the file attributes of that report I generated into word document, so that no one can modify the report that was generated. I need to set the report into a Read-Only file.

The report is being generated for later viewing.

xyberfrend
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
I would look into

1.  Manipulating the file by adding a password
2.  Manipulating the file attributes.

I don't know asp so I can't help you with the code but there should be a way to add the MS Word object to your program and add a password to the file.

mlmcc
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Commented:
You might also consider using a PDF file instead. It only takes a single click to reset the read-only attribute on a file.  Modifying a PDF is a little more difficult.

DRRYAN3
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Good thought.

mlmcc

Author

Commented:
Thanks for the suggestion.
But what I need is to output the file in a word format. This way, there will be no need to install an acrobat reader in every PC.

PDF file needs an acrobat reader to view the file.

The report I am generating is so confidential that It should not be modified by anyone.

Do you think it is feasible. Is there a property of the object ExportOptions that can be set to a READ-ONLY attribute.



 

Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Why did you accept the comment as an answer if it really doesn't solve your problem?

The only way I know to really ensure no one can change the fie is to password protect it and you or th originator be the only one with the password.

What operating system are you using?  If it is Win2K you may be able to use system file protections.  For example put it in a directory where you have write privileges but the rest only have read.

mlmcc

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial