Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 2nd, 2006, 06:38 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts
Default export to word

hey i m creating a report, i want to export it to word.
as the data is coming from various schema's and data is dynamic so after one page is over it should have header and footer with pagebreak.
right now i m using a word object in vb.net but it is not allowing me to create a new application due to some access problem even though i have given full rights to everyone.

pl help i have to release my system....

thnks in advance



__________________
Komila Kalia
Software Developer
Reliance engineering Associates (P) Ltd.
  #2 (permalink)  
Old August 7th, 2006, 01:24 AM
Registered User
 
Join Date: Aug 2006
Location: mumbai, maharashtra, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Komila,
I am exporting to pfd.this code will help u exporting to word
on buttton click i am exporting my data to pdf.

u just hv to change this things:-
Response.ContentType = "application/vnd.ms-word";
ExportToStream(CrystalDecisions.Shared.ExportForma tType.WordForWindows)

private void export_Click(object sender, System.EventArgs e)
        {

            // this is to give the log on info ...
            TableLogOnInfo logonInfo = new TableLogOnInfo();
            logonInfo = rpt.Database.Tables[0].LogOnInfo;
            logonInfo.ConnectionInfo.ServerName = "server";
            logonInfo.ConnectionInfo.DatabaseName = "shirazee";
            logonInfo.ConnectionInfo.UserID = "sa";
            logonInfo.ConnectionInfo.Password = "1234";
            rpt.Database.Tables[0].ApplyLogOnInfo(logonInfo);
            MemoryStream oStream; // using System.IO

            // this code is to export report to pfd
                oStream = (MemoryStream)

                rpt.ExportToStream(CrystalDecisions.Shared.ExportF ormatType.PortableDocFormat);
                Response.Clear();
                Response.Buffer= true;
                Response.ContentType = "application/pdf";
                Response.BinaryWrite(oStream.ToArray());
                Response.End();


        }
  #3 (permalink)  
Old August 12th, 2006, 01:10 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts
Default

thnks for reply skajani
can u tell me if i want to convert to pdf then wat i have to write. and my report is not crystal report. its just an aspx page.

n even i want to  add header and footer to my that report after and before page break.
do u have any idea how to do that.?:(
  #4 (permalink)  
Old July 19th, 2013, 05:39 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Komila, you can also try this .NET Word component. Here is a simple hello world sample code how to create and write word file in C# which will contain Hello World text, Page Break and a page number in footer:

Code:
// Create a new empty document.
DocumentModel document = new DocumentModel();

// Add document content.
document.Sections.Add(
    new Section(document,
        new Paragraph(document,
            new Run(document, "Hello World"),
            new SpecialCharacter(document, SpecialCharacterType.PageBreak))));

// Add document footer with page number.
document.Sections[0].HeadersFooters.Add(
    new HeaderFooter(document, HeaderFooterType.FooterDefault,
        new Paragraph(document,
            new Run(document, "Page number: "),
            new Field(document, FieldType.Page))));

// Save the document to a file.
document.Save("\\Document.docx");
To add you can easily convert Word file to a PDF in C# just by saving the document with .pdf extension.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to word document lily611 General .NET 2 July 30th, 2013 05:44 AM
Export a Table into Word hewstone999 Access VBA 0 March 20th, 2008 07:28 AM
problem with export to word an image ultra08rrg Pro JSP 1 December 20th, 2006 03:41 AM
Export Recordset to Word Document blackdevil1979 VB How-To 0 September 2nd, 2004 04:54 AM



All times are GMT -4. The time now is 04:54 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.