Thanks for viewing my post. I'm looking for ideas regarding creating a document with rtf. I started using word to create a word document automatically, but word automation does not work too well server side, and it is not recommended to do so by Microsoft. I know how to do basic text with rtf, but I'm wondering if I could create a template with bookmarks and fill in these bookmarks with data from a database. Any ideas would be appreciated. I'm not looking for handouts (ex- coding), just looking for ideas. Thank again for your time! Any info will be greatly appreciated! I'm using asp.net.
Josh
I'm going to go at this in a new way. I'm going to create a html document with 'placeholders'. Then I will call on the document to save with the .doc extension. Testing has shown that Microsoft Word will open this document. Thanks again.
Josh
Public Function GetTemplate( _
ByVal strTemplateFile As String) As String
Dim strPath As String = ""
strPath = Server.MapPath("~/Templates") & "\" & strTemplateFile
Return My.Computer.FileSystem.ReadAllText(strPath)
End Function
and
Dim strTemplate As String = ""
Dim blnLB As Boolean = True
strTemplate = GetTemplate("Legislative_Bulletin.htm")
Response.AppendHeader("Content-Type", "application/msword")
Response.AppendHeader("Content-disposition", "attachment; filename=Legislative_Bulletin" & ".doc")
Response.Write(strTemplate)
Response.End()
this is just example coding. you will still need to insert the data into the placeholders of the html template. I hope this helps someone!
Josh
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.