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 7129569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:15:23+00:00 2026-05-28T11:15:23+00:00

Currently I’m using OleDB to connect with Excel Spreadsheet and getting data in a

  • 0

Currently I’m using OleDB to connect with Excel Spreadsheet and getting data in a DataTable, doing some modifications on data and then copying the data to Word.

In doing so I’m losing the formatting of the cell, like if any part of text was colored or if the background color was grayed or if it’s bold.

I’m using Interop library to communicate with word and OLEDB with Excel.

If this solution is not good enough for what I need to achieve , can you suggest alternative solutions? (Macros?)
I tried using Interop.Excel.Styles but I can’t figure out how to relate it with the cell being currently used.

  • 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-05-28T11:15:24+00:00Added an answer on May 28, 2026 at 11:15 am

    We copy the range of the table in the spreadsheet and the directly paste in the word document which preserves formatting.

    wordDoc.Tables.Add(b.Range,newsheet.UsedRange.Rows.Count,newsheet.UsedRange.Columns.Count);
    Microsoft.Office.Interop.Word.Table table = b.Range.Tables[1];
    newsheet.UsedRange.Copy();
    table.Range.Select(); 
    wordApp.Selection.Paste();
    

    wordDoc is Word.Document and wordApp is word.Application. Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm doing some unit tests which are executed from bash. Unit tests are
Currently, working with RC0 Denali, having some issues I am attempting to review data
Currently I know of only two ways to cache data (I use PHP but
Currently, I am developing a product that does fairly intensive calculations using MS SQL
Currently I using the following code to get my JSON output from MySQL. <?php
Currently, my code shows a loading spinner gif, returns the data and caches it.
Currently in my comp., there are some changes going on regarding project documentation. There
Currently I have some legacy ASP.NET 2.0 code that uses the ASP Xml web
Currently I'm doing a project whose specifications are unclear - well who doesn't. I
Currently i'm having trouble using two functions in my -(void)viewDidLoad , both of these

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.