Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8445887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:46:40+00:00 2026-06-10T09:46:40+00:00

The table which I am trying to export is imported in Crystal Reports from

  • 0

The table which I am trying to export is imported in Crystal Reports from a SQL database in Visual Studio 2008 where I am making a web application with C#. I am trying to export it to a word document but to keep the table formatting which I can later on edit in MS WORD. However, all i get is a bunch of text boxes.

I tried exporting it as an excel document and then copying to word, and that worked, but I need to be able to do that solely through C# code.

So the question is: Is there a better way to directly have an editable table in word document exported from crystal reports, or is there a solution how to copy an excel table in word but only doing so by c# code?

I really appreciate any help! I’m googling for a couple of days and I still haven’t found a proper solution…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:46:42+00:00Added an answer on June 10, 2026 at 9:46 am

    I managed to insert the Excel document to Word and then save it. The minor problem with just tha data paths needs a little tweaking, but besides that it works 🙂

    private void ConvertExcelToWordAndAutoSave()
    {

            Excel.Application xlApp;
            Excel.Workbook xlWorkBook;
            Excel.Worksheet xlWorkSheet;
           //TT Excel.Range range;
    
    
    
            object misValue = System.Reflection.Missing.Value;
    
            DateTime dt = new DateTime();
            dt = DateTime.Now;
    
                // open excel 
                xlApp = new Excel.ApplicationClass();
                //Change THE LOCATION!
                xlWorkBook = xlApp.Workbooks.Open("C:\\Documents and Settings\\Student\\Desktop\\ExportFiles\\Excel.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlWorkSheet=(Excel.Worksheet)xlWorkBook.ActiveSheet;
    
    
    
    
                // open word 
                object oMissing = System.Reflection.Missing.Value;
                object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
    
                //Start Word and create a new document.
                Word._Application oWord;
                Word._Document oDoc;
    
                oWord = new Word.Application();
                oWord.Visible = true;
                oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
    
    
    
                Word.Paragraph oPara1;
                oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
                oPara1.Range.Text = "Snimeno na:" + " " + dt+"\n";
                oPara1.Range.Font.Bold = 1;
                oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.
                oPara1.Range.InsertParagraphAfter();
    
    
    
    
                xlWorkSheet.get_Range("A1", "N49").Copy(Missing.Value);
    
                oWord.Selection.Paste();
    
                oWord.Selection.TypeParagraph();
               //The textBox is for the name of the new Word document
                if (TextBox1.Text == "")
                    TextBox1.Text = "Document1";
             object fileName = @"C:\\Documents and Settings\\Student\\Desktop\\ExportFiles\\"+TextBox1.Text+".docx"; 
    
                oDoc.SaveAs(ref fileName,
                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the Crystal Reports designer that came with Visual Studio 2008. My
I am trying to export some data from a SQL Express table to Access
I'm trying to export from SQL Server to Oracle a table that consists of
I'm trying to return an XML from a table which holds a Geography type.
I'm trying to create an XML sitemap using CakePHP, from a table which has
I have a CSV export script (enrdata_arch.php) which calls information from an existing database
I am using Oracle SQL Developer and trying to export a table to a
I'm trying to import an 82k+ row table from an access db to SQL
I am trying to remove all references to a table from a Crystal XI
I am trying to export data from my MySQL database to multiple CSV files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.