Free Support Forum - aspose.com

Is it possible to save a document as a .net resource?

In a WinForms application we have some documents that we use to produce reports. Currently they are saved in a “documents” folder off the application root. We want to protect these source documents and prevent the user from deleting them, or overwriting them with other documents.

What is the best way to do that? Can Word documents be stored as a resource for the application? I’m not familiar with using .Net resource files, so any help here would be appreciated.

Thanks

Hi,

Thank you for your interest in Aspose.Word.

MS Word documents can be surely stored as .NET resources, please see MSDN library to learn about the System.Resources namespace. However, you should choose a way to store your documents yourself and I cannot advise you “the best” way here.

This answer is coming from a fellow programmer. Not related in any ways to Aspose. (CarlCouture@Cox.net)

You could also save your Word Doc in SQL Server. See: http://support.microsoft.com/default.aspx?scid=kb;en-us;326502 for more information on how to do it. That example will save a jpeg file but it also works for any type of documents, MsWord, Excel, PDF etc.

Is it the “Best Way” to do it? Depends on your needs but it’s sure easy to backup and quite efficient against user’s deletion.

Thanks for the advice. I have stored Word (and other types) of documents in SQL Server in the past. In this case, we only have a few reports, and the effort of writing the code to create an interface to permit someone to stream them in and out of the database is not worth it.