Click to See Complete Forum and Search --> : Can We Use Microsoft Word Template For Output
kamran123
February 22nd, 2007, 12:40 AM
I need to send the data from Crystal Report to the Microsoft Word Template which will have bookmarks for the particular fields.Crystal Report will connect to the database and will export all the data to Microsoft Word Template.Is it possible .Plz someone give the Solution.
HanneSThEGreaT
February 22nd, 2007, 02:27 AM
Yes. :)
Whether your are using VB.NET or C#, you can use the :
ExportOptions
DiskFileDestinationOptions
Methods in the CrystalDecisions.Shared namespace.
Here is a very small code example, which I use in VB.NET 2003, to achieve this :
Dim exportOpts As New CrystalDecisions.Shared.ExportOptions 'export options for report
Dim diskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions 'saving location options
exportOpts = rpt1.ExportOptions
' Set the export format.
exportOpts.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.WordForWindows
exportOpts.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
' Set the disk file options.
diskOpts.DiskFileName = "C:\WordDocument.dot" 'specify template file here!
exportOpts.DestinationOptions = diskOpts
' Export the report.
rpt1.Export() 'rpt1 is the name of my Crystal Report
This exports the Crystal report to a Word Template named "WordDocument.dot" on the C:\ drive
Does this help ¿
kamran123
February 23rd, 2007, 05:57 AM
I was happy to read the first line of your reply answer.You said Yes.
I think you did not read my question carefully. i mentoined the template has bookmark which will be used as place holder for the particulare field in Crystal Report.
Plz Solve it again.
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.