Amitava_Mukherjee
asked on
word, excel file creation without attaching reference dll
right click on the windows desktop shows a menu "New". anyone can create new file like word, excel, access etc by selecting the corresponding file type. i am writing code in vb.net 2008 express edition. i wantto create various files like that interface. i want to create exs. xtsx, doc, docx etc. through my code. everywhere i found i have to add the corresponding old/tlb files or dll for excel, word etc. but in my development PC office 2007 is there, but in client PC office 2003 may be there. so i can not attach that reference as it will not work in those pc. any suggestion for this problem? can i create doc/docx, xls/xlsx files without adding the reference in my code? thanx in advance. I tried the following code, but creation of docx generates problem in that process, the docx is creating but not opening by that method. any alternative?
Dim fs As New FileStream(gsParent2FullPath & "\" & gnodCurrent.FullPath & "\" & InFileName, FileMode.CreateNew, FileAccess.ReadWrite)
fs.Close()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanx, nice solution
You have following options :
1. Check dynamically at run time if the user has office 2007 or higher or not. If found then create the docx/xlsx file as per current code otherwise create the doc/xls file.
2. If you do not want to attach any refrence tlb or dll in your installer then include a template files for doc/docx/xls/xlsx in the installer of your application. On user selecting to create a file create a copy of your template file to user defined location and name and format(doc or docx). In this even if user does not have any installation then also he can create a office file.
Cheers!!!