Reading files from application path may be one of key requirement of any application. Actually we can place many place you love to have, on a installation machine there can be restriction as well.
Like wise in a Windows system, installer may want to put apps and other files to Programfiles. This folder intended to work with executable,configuration files etc. You can’t programmatically create new folder or files in Programfiles folder, which may require some admin rights. So where we kept those documents and other data ?
It is wise to store such files on Application data folder or even on your Document folder. For reports and other stuffs Document folder is enough.
Access Special Folders
We can use the Enironment.SpecialFolder to access the App data and Documents and also can fetch path to those folders using GetFolderPath method of Environment class.
Serialization is the process of storing objects / user defines classes into a disc files. It stores state of the object i.e. member variable values to disk. Deserialization is reverse of serialization i.e. it’s a process of reading objects from a file where they have been stored.
As you know encryption is to hide information from others .Encryption and decryption operations require a special key. Think of a key as a password for the encryption and decryption operations
Serialization and encryption
My Serialize Helper class assist you to serialize any object or object collection to binary data file and also it encrypt data using DESCryptoServiceProvider class. Using the BinaryFormatter we can serialize objects and save into a file. Like wise we can reverse the process too.
Word Document is an essential part of any application, it may help users to prepare reports etc. You can easily create Documents programamatically using Microsoft.Office.Interop.Word Library in C#.Net.
This Library also provide capability of converting document to two another monstly used file format, PDF and XPS. Let’s beggin
First up all add refrence to Microsoft.Office.Interop.Word and Include to the project
and do the following
Open the File want to convert with Document constructor
Use ExExportAsFixedFormat to convert document into pdf
Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application();
var wordDocument = appWord.Documents.Open("mydoc.docx");
In the similary way you can convert document to XPS too
Ask Masrshal to realease resources
Finally we are no need to hold the Word resources , ask Marshal to release them. Do this when ever you use file resources.