473,564 Members | 2,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening a Word 2003 template

I need to open a Word template so that I can merge some data from a database
with the document. I am using ASP.NET, VB.NET. I can not even get MS Word to
be visible. I can see that an instance is created in Task Manager.

Here is my code:

Private Sub createReport()
Dim missing As Object = System.Reflecti on.Missing.Valu e
Dim file_name As String
Dim file_path As String
Dim file_title As String
Dim word_server As Word.Applicatio nClass
Dim sFile As String

sFile = context.Request .PhysicalApplic ationPath &
"ScreeningRepor t.dot"
word_server = New Word.Applicatio n
word_server.Vis ible = True
'''word_server. ChangeFileOpenD irectory(file_p ath)
word_server.Doc uments.Open( _
FileName:=sFile , _
ConfirmConversi ons:=False, _
ReadOnly:=False , _
AddToRecentFile s:=False, _
PasswordDocumen t:="", _
PasswordTemplat e:="", _
Revert:=False, _
WritePasswordDo cument:="", _
WritePasswordTe mplate:="", _
Format:=Word.Wd OpenFormat.wdOp enFormatAuto, Visible:=True)

word_server.Sel ection.GoTo( _
What:=Word.WdGo ToItem.wdGoToBo okmark, _
Name:="clientna me")
word_server.Sel ection.TypeText ( _
Text:="<Here is the bookmark>")
word_server.Vis ible = True

End Sub

Why can I not even see the document in the browser?

Also, I have created this using the version of Crystal Reports that comes
with Visual Studio 2003. I have read that it is not re-distributable and is a
trial version. Is this true?

Thanks,
enak
--
enak
Mar 27 '06 #1
4 2024
First you need to decide whether you're trying to open Word on the client,
on the server, or both.
Server side COM automation with Office is not recommended:
http://support.microsoft.com/default...US;q257757#kb2

Here are some tips and suggestions for working with Word (and Excel) the
right way:
http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/reviews/AsposeWord.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx
http://msdn.microsoft.com/office/understanding/vsto/

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"enak" <en**@discussio ns.microsoft.co m> wrote in message
news:65******** *************** ***********@mic rosoft.com...
I need to open a Word template so that I can merge some data from a
database
with the document. I am using ASP.NET, VB.NET. I can not even get MS Word
to
be visible. I can see that an instance is created in Task Manager.

Here is my code:

Private Sub createReport()
Dim missing As Object = System.Reflecti on.Missing.Valu e
Dim file_name As String
Dim file_path As String
Dim file_title As String
Dim word_server As Word.Applicatio nClass
Dim sFile As String

sFile = context.Request .PhysicalApplic ationPath &
"ScreeningRepor t.dot"
word_server = New Word.Applicatio n
word_server.Vis ible = True
'''word_server. ChangeFileOpenD irectory(file_p ath)
word_server.Doc uments.Open( _
FileName:=sFile , _
ConfirmConversi ons:=False, _
ReadOnly:=False , _
AddToRecentFile s:=False, _
PasswordDocumen t:="", _
PasswordTemplat e:="", _
Revert:=False, _
WritePasswordDo cument:="", _
WritePasswordTe mplate:="", _
Format:=Word.Wd OpenFormat.wdOp enFormatAuto, Visible:=True)

word_server.Sel ection.GoTo( _
What:=Word.WdGo ToItem.wdGoToBo okmark, _
Name:="clientna me")
word_server.Sel ection.TypeText ( _
Text:="<Here is the bookmark>")
word_server.Vis ible = True

End Sub

Why can I not even see the document in the browser?

Also, I have created this using the version of Crystal Reports that comes
with Visual Studio 2003. I have read that it is not re-distributable and
is a
trial version. Is this true?

Thanks,
enak
--
enak

Mar 27 '06 #2
I don't want to use Word on the server. What I really need is to be able to
have page headers and footers on the documents that are created. I am not
aware of a way to do that by creating the document in HTML and then changing
the context of the header.

This is why I need a better way to do this. I am looking at using Crystal
Reports that comes with VS 2003.
--
enak
"Steve C. Orr [MVP, MCSD]" wrote:
First you need to decide whether you're trying to open Word on the client,
on the server, or both.
Server side COM automation with Office is not recommended:
http://support.microsoft.com/default...US;q257757#kb2

Here are some tips and suggestions for working with Word (and Excel) the
right way:
http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/reviews/AsposeWord.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx
http://msdn.microsoft.com/office/understanding/vsto/

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"enak" <en**@discussio ns.microsoft.co m> wrote in message
news:65******** *************** ***********@mic rosoft.com...
I need to open a Word template so that I can merge some data from a
database
with the document. I am using ASP.NET, VB.NET. I can not even get MS Word
to
be visible. I can see that an instance is created in Task Manager.

Here is my code:

Private Sub createReport()
Dim missing As Object = System.Reflecti on.Missing.Valu e
Dim file_name As String
Dim file_path As String
Dim file_title As String
Dim word_server As Word.Applicatio nClass
Dim sFile As String

sFile = context.Request .PhysicalApplic ationPath &
"ScreeningRepor t.dot"
word_server = New Word.Applicatio n
word_server.Vis ible = True
'''word_server. ChangeFileOpenD irectory(file_p ath)
word_server.Doc uments.Open( _
FileName:=sFile , _
ConfirmConversi ons:=False, _
ReadOnly:=False , _
AddToRecentFile s:=False, _
PasswordDocumen t:="", _
PasswordTemplat e:="", _
Revert:=False, _
WritePasswordDo cument:="", _
WritePasswordTe mplate:="", _
Format:=Word.Wd OpenFormat.wdOp enFormatAuto, Visible:=True)

word_server.Sel ection.GoTo( _
What:=Word.WdGo ToItem.wdGoToBo okmark, _
Name:="clientna me")
word_server.Sel ection.TypeText ( _
Text:="<Here is the bookmark>")
word_server.Vis ible = True

End Sub

Why can I not even see the document in the browser?

Also, I have created this using the version of Crystal Reports that comes
with Visual Studio 2003. I have read that it is not re-distributable and
is a
trial version. Is this true?

Thanks,
enak
--
enak


Mar 27 '06 #3
Yes, Crystal Reports could work, although its not my first choice.
The new VSTO should also work:
http://msdn.microsoft.com/office/understanding/vsto/

And these two 3rd party products should work well too:
http://SteveOrr.net/reviews/AsposeWord.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"enak" <en**@discussio ns.microsoft.co m> wrote in message
news:A1******** *************** ***********@mic rosoft.com...
I don't want to use Word on the server. What I really need is to be able to
have page headers and footers on the documents that are created. I am not
aware of a way to do that by creating the document in HTML and then
changing
the context of the header.

This is why I need a better way to do this. I am looking at using Crystal
Reports that comes with VS 2003.
--
enak
"Steve C. Orr [MVP, MCSD]" wrote:
First you need to decide whether you're trying to open Word on the
client,
on the server, or both.
Server side COM automation with Office is not recommended:
http://support.microsoft.com/default...US;q257757#kb2

Here are some tips and suggestions for working with Word (and Excel) the
right way:
http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/reviews/AsposeWord.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx
http://msdn.microsoft.com/office/understanding/vsto/

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"enak" <en**@discussio ns.microsoft.co m> wrote in message
news:65******** *************** ***********@mic rosoft.com...
>I need to open a Word template so that I can merge some data from a
>database
> with the document. I am using ASP.NET, VB.NET. I can not even get MS
> Word
> to
> be visible. I can see that an instance is created in Task Manager.
>
> Here is my code:
>
> Private Sub createReport()
> Dim missing As Object = System.Reflecti on.Missing.Valu e
> Dim file_name As String
> Dim file_path As String
> Dim file_title As String
> Dim word_server As Word.Applicatio nClass
> Dim sFile As String
>
> sFile = context.Request .PhysicalApplic ationPath &
> "ScreeningRepor t.dot"
> word_server = New Word.Applicatio n
> word_server.Vis ible = True
> '''word_server. ChangeFileOpenD irectory(file_p ath)
> word_server.Doc uments.Open( _
> FileName:=sFile , _
> ConfirmConversi ons:=False, _
> ReadOnly:=False , _
> AddToRecentFile s:=False, _
> PasswordDocumen t:="", _
> PasswordTemplat e:="", _
> Revert:=False, _
> WritePasswordDo cument:="", _
> WritePasswordTe mplate:="", _
> Format:=Word.Wd OpenFormat.wdOp enFormatAuto, Visible:=True)
>
> word_server.Sel ection.GoTo( _
> What:=Word.WdGo ToItem.wdGoToBo okmark, _
> Name:="clientna me")
> word_server.Sel ection.TypeText ( _
> Text:="<Here is the bookmark>")
> word_server.Vis ible = True
>
> End Sub
>
> Why can I not even see the document in the browser?
>
> Also, I have created this using the version of Crystal Reports that
> comes
> with Visual Studio 2003. I have read that it is not re-distributable
> and
> is a
> trial version. Is this true?
>
> Thanks,
> enak
> --
> enak


Mar 27 '06 #4
I don't have the new VS 2005 installed. I am under a time crunch, too.
--
enak
"Steve C. Orr [MVP, MCSD]" wrote:
Yes, Crystal Reports could work, although its not my first choice.
The new VSTO should also work:
http://msdn.microsoft.com/office/understanding/vsto/

And these two 3rd party products should work well too:
http://SteveOrr.net/reviews/AsposeWord.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"enak" <en**@discussio ns.microsoft.co m> wrote in message
news:A1******** *************** ***********@mic rosoft.com...
I don't want to use Word on the server. What I really need is to be able to
have page headers and footers on the documents that are created. I am not
aware of a way to do that by creating the document in HTML and then
changing
the context of the header.

This is why I need a better way to do this. I am looking at using Crystal
Reports that comes with VS 2003.
--
enak
"Steve C. Orr [MVP, MCSD]" wrote:
First you need to decide whether you're trying to open Word on the
client,
on the server, or both.
Server side COM automation with Office is not recommended:
http://support.microsoft.com/default...US;q257757#kb2

Here are some tips and suggestions for working with Word (and Excel) the
right way:
http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/reviews/AsposeWord.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx
http://msdn.microsoft.com/office/understanding/vsto/

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"enak" <en**@discussio ns.microsoft.co m> wrote in message
news:65******** *************** ***********@mic rosoft.com...
>I need to open a Word template so that I can merge some data from a
>database
> with the document. I am using ASP.NET, VB.NET. I can not even get MS
> Word
> to
> be visible. I can see that an instance is created in Task Manager.
>
> Here is my code:
>
> Private Sub createReport()
> Dim missing As Object = System.Reflecti on.Missing.Valu e
> Dim file_name As String
> Dim file_path As String
> Dim file_title As String
> Dim word_server As Word.Applicatio nClass
> Dim sFile As String
>
> sFile = context.Request .PhysicalApplic ationPath &
> "ScreeningRepor t.dot"
> word_server = New Word.Applicatio n
> word_server.Vis ible = True
> '''word_server. ChangeFileOpenD irectory(file_p ath)
> word_server.Doc uments.Open( _
> FileName:=sFile , _
> ConfirmConversi ons:=False, _
> ReadOnly:=False , _
> AddToRecentFile s:=False, _
> PasswordDocumen t:="", _
> PasswordTemplat e:="", _
> Revert:=False, _
> WritePasswordDo cument:="", _
> WritePasswordTe mplate:="", _
> Format:=Word.Wd OpenFormat.wdOp enFormatAuto, Visible:=True)
>
> word_server.Sel ection.GoTo( _
> What:=Word.WdGo ToItem.wdGoToBo okmark, _
> Name:="clientna me")
> word_server.Sel ection.TypeText ( _
> Text:="<Here is the bookmark>")
> word_server.Vis ible = True
>
> End Sub
>
> Why can I not even see the document in the browser?
>
> Also, I have created this using the version of Crystal Reports that
> comes
> with Visual Studio 2003. I have read that it is not re-distributable
> and
> is a
> trial version. Is this true?
>
> Thanks,
> enak
> --
> enak


Mar 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7401
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the collection that I need. To begin, I am using xsltproc that conmes with Cygwin as my processor. I have no particular affinity to this processor except...
0
1395
by: Mandarb | last post by:
H I have to open a MS Word 2003 document from a web page and then save it to a web server. My problem is that I can't find out how to make a new document from a template in code. The templates that I use have some code in from where I copy the custom forms to the new document, but just opening the template and saving it as a document, screws...
0
3995
by: Sivaraman.S | last post by:
Issue: When I am opening a word document or a template from an ASP.NET Web page (language used VB.NET Visual Studio Version 2003) using Word.ApplicationClass object (Reference Word 11.0 object Library), I am getting the following error: could not open macro storage (System.Runtime.comExeception) I am not getting any errors while opening...
3
5570
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge document in Word; 2. opens the document and runs the merge process for the new data. I have managed to write the code to perform step 1 ok, but I'm...
4
11121
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone done this? Does it seem possible? I followed the instructions from a sample on the Microsoft knowledge base but it only seems to work when creating...
3
6107
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone done this? Does it seem possible? I followed the instructions from a sample on the Microsoft knowledge base but it only seems to work when creating...
0
4903
by: Sivaraman.S | last post by:
Issue : When I am trying to open a Word Document or a Template from a Web Application (ASP.NET Web page - Language Used VB.NET Visual Studio Version 2003) using Word.ApplicationClass (Refering Word 11.0 Library), I am getting the following Errror: Could not open Macro storage. (System.Runtime.ComExeception) When I am Opening the word...
7
6229
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the user and populated (with info from an Access database) at run-time, then saved as Word documents. The program I have coded works fine -- it does...
5
2554
by: Cedric | last post by:
Hi Folks, I'm wondering if someone has already succeed to open a word2000 document located on server side with javascript code executed by a web browser on client side. In fact, i make it without any problem when the client use Word XP & 2003 but no result with Word 2000. Any suggestions are welcomed,
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.