I want to read the formatted (bold,underline ,italics) text of a word dcoument using c#
i can read the document even the paragraphn in it but not the formatted text
plzz help
following is the code
private void btnRead_Click(o bject sender, EventArgs e)
{
// ReadFile(textBo x1.Text);
// Use the open file dialog to choose a word document
if (this.openFileD ialog1.ShowDial og() == DialogResult.OK )
{
// set the file name from the open file dialog
object fileName = openFileDialog1 .FileName;
object readOnly = false;
object isVisible = true;
object nullobj = System.Reflecti on.Missing.Valu e;
// Here is the way to handle parameters you don't care about in .NET
object missing = System.Reflecti on.Missing.Valu e;
// Make word visible, so you can see what's happening
WordApp.Visible = true;
// Open the document that was chosen by the dialog
Word.Document aDoc = WordApp.Documen ts.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
Word.Applicatio nClass wordApp = new Word.Applicatio nClass();
aDoc.ActiveWind ow.Selection.Wh oleStory();
aDoc.ActiveWind ow.Selection.Co py();
IDataObject data = Clipboard.GetDa taObject();
txtFileContent. Text = data.GetData(Da taFormats.Text) .ToString();
}
}
0 1690 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: James Turner |
last post by:
I am trying to store formatted text (windows format) into a MySQL
database and then retrieve it. The field in the database is a
varchar. I cut and paste the test into a form field formatted, then
call the PHP program to add the record using POST. When I get the
text out, it has lost it's formatting. Formatting in the text is
achieved by multiple spaces not tabs, but even multiple spaces are
converted to a single space and the carrage...
|
by: Jason Heyes |
last post by:
I am starting to worry about the performance of formatted read/write
operations on data-redundant objects in my program.What can I do to improve
this performance should it become an issue?
Thanks.
|
by: Patrice Kadionik |
last post by:
Hi all,
I want to make a brief comparison between read() and fread() (under a
Linux OS).
1. Family read and Co: open, close, read, write, ioctl...
2. Family fread and Co: fopen, fclose, fread, swrite, fcntl...
Family read and Co:
|
by: MLH |
last post by:
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.
I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this
If txtLaborCost...
|
by: John |
last post by:
I have a text file that is formatted like this:
123456789 SOLD 1
12/12/2006 Smith 45,525
987654321 SOLD 3
01/01/2006 Jones 23,252
| |
by: Prasanta |
last post by:
Hello,
Please cnay one can tell me how to read mail as formatted.... i have made
some code using that able to read but not able to serialize..... so am i need
to parse the HTML, or is there any class using that i can directly get the
full info ablt the mail, like TO,From,Subject,Body,Attachments,
Below is the code which i develop,
using System;
|
by: Prasanta |
last post by:
Hello,
How to read a mail from the mail server as formatted. I am able to read the
mail as row HTML, is there any class, or something method using that i can
easily get the all info of that mail, like as TO,From,Subject,Body. here I am
attaching my coe which i developed.
using System;
using System.Collections.Generic;
using System.Text;
|
by: robbiesmith79 |
last post by:
Just so this is out there on the web, I battled the past 24 hours
about this. Background info... I developed a ecommerce website in PHP
4 on a shared linux hosting plan from GoDaddy and had the html
formatted emails sending as text/html and were going fine with limited
header information. Then we moved the site over to a Dedicated Linux
hosting plan. This time, it's PHP 5. Things are bound to not work as
expected moving to a new...
|
by: cybervigilante |
last post by:
I sent HTML formatted email, using PHP, to my Yahoo address from my
server, and it came out fine, styles and all. I sent it to my gmail
address to test it and all I see is the raw html code. But I do get
formatted email in gmail, so I know people make it work somehow. I'm
looking right at a gmail message that I copied to Dreamweaver and it's
using Strong and Red text attributes that work in gmail. But mine
don't.
What do you do...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |