WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How to convert a word .doc file into .tif file in c#?

 
   Home -> Office -> Conversions RSS
Next:  I try to open old docs (Word 95-98) in Word 2000 ..  
Author Message
vincent

External


Since: Nov 02, 2006
Posts: 21



(Msg. 1) Posted: Wed Jul 11, 2007 2:14 am
Post subject: How to convert a word .doc file into .tif file in c#?
Archived from groups: microsoft>public>word>conversions (more info?)

How to convert a word .doc file into .tif file in c#?
Many thanks for your replying.
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 8385



(Msg. 2) Posted: Wed Jul 11, 2007 12:24 pm
Post subject: Re: How to convert a word .doc file into .tif file in c#? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In order to convert to a TIF (or any other graphics format) file you would
have to use screen capture, or output to a 'printer' driver capable of
creating TIF files (such as Microsoft Document Imaging or SnagIt) which
would require Word to be open. How you would arrange this from an external
programming language I have no idea - a forum for that language would be
start.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

vincent wrote:
> How to convert a word .doc file into .tif file in c#?
> Many thanks for your replying.
Back to top
Login to vote
vincent

External


Since: Nov 02, 2006
Posts: 21



(Msg. 3) Posted: Wed Jul 11, 2007 12:24 pm
Post subject: Re: How to convert a word .doc file into .tif file in c#? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I just find a solution.
thank you very much.
private void print()
{
try
{
// Declaring the object variables we will need later
object varFileName = "c:\\test\\test.docx";
object varFalseValue = false;
object varTrueValue = true;
object varMissing = Type.Missing;
// Create a reference to MS Word application
Microsoft.Office.Interop.Word.Application varWord = new
Microsoft.Office.Interop.Word.Application();
//設定印表機
varWord.ActivePrinter = "Microsoft Office Live Meeting
Document Writer";
// Creates a reference to a word document
Microsoft.Office.Interop.Word.Document varDoc =
varWord.Documents.Open(ref varFileName, ref varMissing, ref varFalseValue,
ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
varMissing, ref varMissing, ref varMissing, ref varMissing, ref varMissing,
ref varMissing, ref varMissing, ref varMissing, ref varMissing);
// Activate the document
varDoc.Activate();

// Print the document
object PrintToFile = true;
object OutputFileName = "c:\\test\\test.tif";
varDoc.PrintOut(ref varMissing, ref varFalseValue, ref
varMissing, ref OutputFileName, ref varMissing, ref varMissing, ref
varMissing, ref varMissing, ref varMissing, ref varMissing, ref PrintToFile,
ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
varMissing, ref varMissing, ref varMissing);

varDoc.Close(ref varMissing, ref varMissing, ref varMissing);
varWord.Quit(ref varMissing, ref varMissing, ref varMissing);
}
catch (Exception varE)
{
MessageBox.Show("Error:\n" + varE.Message, "Error message");
}
}

"Graham Mayor" wrote:

> In order to convert to a TIF (or any other graphics format) file you would
> have to use screen capture, or output to a 'printer' driver capable of
> creating TIF files (such as Microsoft Document Imaging or SnagIt) which
> would require Word to be open. How you would arrange this from an external
> programming language I have no idea - a forum for that language would be
> start.
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> vincent wrote:
> > How to convert a word .doc file into .tif file in c#?
> > Many thanks for your replying.
>
>
>
Back to top
Login to vote
ibs

External


Since: Dec 31, 2007
Posts: 7



(Msg. 4) Posted: Mon Dec 31, 2007 3:24 pm
Post subject: Re: How to convert a word .doc file into .tif file in c#? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hello vincent,
can you please help me in writing the c# code to convert doc to docx file.
any help on this is much appreciable.
many thanks for your help.
regards
ibs
Back to top
Login to vote
vincent

External


Since: Nov 02, 2006
Posts: 21



(Msg. 5) Posted: Wed Jan 02, 2008 12:01 am
Post subject: Re: How to convert a word .doc file into .tif file in c#? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi!
Thank you for asking.
I do not convert a doc to a docx before.
Try following codes please.

WORD._Application word = null;
WORD._Document document = null;
Object fileName = (Object)tagetFileName;

try
{
word = new WORD.Application();
//open your doc file
document = word.Documents.Open(ref fileName, ref missing,
ref falseValue, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref
missing,
ref missing, ref missing, ref missing, ref missing, ref
missing,
ref missing
);

// Activate the document
document.Activate();
//save as docx, please set the fileFormat to docx
document.SaveAs(
/* ref object FileName */ ref fileName,
/* ref object FileFormat */ ref fileFormat,
/* ref object LockComments */ ref missing,
/* ref object Password */ ref missing,
/* ref object AddToRecentFiles */ ref missing,
/* ref object WritePassword */ ref missing,
/* ref object ReadOnlyRecommended */ ref missing,
/* ref object EmbedTrueTypeFonts */ ref missing,
/* ref object SaveNativePictureFormat */ ref missing,
/* ref object SaveFormsData */ ref missing,
/* ref object SaveAsAOCELetter */ ref missing,
/* ref object Encoding */ ref missing,
/* ref object InsertLineBreaks */ ref missing,
/* ref object AllowSubstitutions */ ref missing,
/* ref object LineEncoding */ ref missing,
/* ref object AddBiDiMarks */ ref missing);
}
catch (COMException)
{
}
finally
{
if (document != null)
{
document.Close(
/* ref object SaveChanges */ ref missing,
/* ref object OriginalFormat */ ref missing,
/* ref object RouteDocument */ ref missing);
document = null;
}

if (word != null)
{
word.Quit(
/* ref object SaveChanges */ ref missing,
/* ref object OriginalFormat */ ref missing,
/* ref object RouteDocument */ ref missing);
word = null;
}
}

GC.Collect();
GC.WaitForPendingFinalizers();

GC.Collect();
GC.WaitForPendingFinalizers();
"ibs" wrote:

> hello vincent,
> can you please help me in writing the c# code to convert doc to docx file.
> any help on this is much appreciable.
> many thanks for your help.
> regards
> ibs
Back to top
Login to vote
GJ

External


Since: Jun 20, 2007
Posts: 9



(Msg. 6) Posted: Mon Sep 07, 2009 1:27 am
Post subject: Re: How to convert a word .doc file into .tif file in c#? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello Vincet,

I tried the same code to convert Wrod-->Tiff. A blank tiff file got generated.
Have you tried this piece of code?
Or you have any other solutions please suggest.

"vincent" wrote:

> I just find a solution.
> thank you very much.
> private void print()
> {
> try
> {
> // Declaring the object variables we will need later
> object varFileName = "c:\\test\\test.docx";
> object varFalseValue = false;
> object varTrueValue = true;
> object varMissing = Type.Missing;
> // Create a reference to MS Word application
> Microsoft.Office.Interop.Word.Application varWord = new
> Microsoft.Office.Interop.Word.Application();
> //設定印表機
> varWord.ActivePrinter = "Microsoft Office Live Meeting
> Document Writer";
> // Creates a reference to a word document
> Microsoft.Office.Interop.Word.Document varDoc =
> varWord.Documents.Open(ref varFileName, ref varMissing, ref varFalseValue,
> ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
> varMissing, ref varMissing, ref varMissing, ref varMissing, ref varMissing,
> ref varMissing, ref varMissing, ref varMissing, ref varMissing);
> // Activate the document
> varDoc.Activate();
>
> // Print the document
> object PrintToFile = true;
> object OutputFileName = "c:\\test\\test.tif";
> varDoc.PrintOut(ref varMissing, ref varFalseValue, ref
> varMissing, ref OutputFileName, ref varMissing, ref varMissing, ref
> varMissing, ref varMissing, ref varMissing, ref varMissing, ref PrintToFile,
> ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
> varMissing, ref varMissing, ref varMissing);
>
> varDoc.Close(ref varMissing, ref varMissing, ref varMissing);
> varWord.Quit(ref varMissing, ref varMissing, ref varMissing);
> }
> catch (Exception varE)
> {
> MessageBox.Show("Error:\n" + varE.Message, "Error message");
> }
> }
>
> "Graham Mayor" wrote:
>
> > In order to convert to a TIF (or any other graphics format) file you would
> > have to use screen capture, or output to a 'printer' driver capable of
> > creating TIF files (such as Microsoft Document Imaging or SnagIt) which
> > would require Word to be open. How you would arrange this from an external
> > programming language I have no idea - a forum for that language would be
> > start.
> >
> > --
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > Graham Mayor - Word MVP
> >
> > My web site www.gmayor.com
> > Word MVP web site http://word.mvps.org
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >
> > vincent wrote:
> > > How to convert a word .doc file into .tif file in c#?
> > > Many thanks for your replying.
> >
> >
> >
Back to top
Login to vote
Bacem

External


Since: Sep 23, 2009
Posts: 1



(Msg. 7) Posted: Wed Sep 23, 2009 3:55 am
Post subject: Re: How to convert a word .doc file into .tif file in c#? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello vincent,

I tried to use the code to convert a word document but i have a problem:
the conversion was terminated succesfully but i have an overview wich
display the content of the document.

any idea to stop the overview ?

Thanks

"vincent" wrote:

> I just find a solution.
> thank you very much.
> private void print()
> {
> try
> {
> // Declaring the object variables we will need later
> object varFileName = "c:\\test\\test.docx";
> object varFalseValue = false;
> object varTrueValue = true;
> object varMissing = Type.Missing;
> // Create a reference to MS Word application
> Microsoft.Office.Interop.Word.Application varWord = new
> Microsoft.Office.Interop.Word.Application();
> //設定印表機
> varWord.ActivePrinter = "Microsoft Office Live Meeting
> Document Writer";
> // Creates a reference to a word document
> Microsoft.Office.Interop.Word.Document varDoc =
> varWord.Documents.Open(ref varFileName, ref varMissing, ref varFalseValue,
> ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
> varMissing, ref varMissing, ref varMissing, ref varMissing, ref varMissing,
> ref varMissing, ref varMissing, ref varMissing, ref varMissing);
> // Activate the document
> varDoc.Activate();
>
> // Print the document
> object PrintToFile = true;
> object OutputFileName = "c:\\test\\test.tif";
> varDoc.PrintOut(ref varMissing, ref varFalseValue, ref
> varMissing, ref OutputFileName, ref varMissing, ref varMissing, ref
> varMissing, ref varMissing, ref varMissing, ref varMissing, ref PrintToFile,
> ref varMissing, ref varMissing, ref varMissing, ref varMissing, ref
> varMissing, ref varMissing, ref varMissing);
>
> varDoc.Close(ref varMissing, ref varMissing, ref varMissing);
> varWord.Quit(ref varMissing, ref varMissing, ref varMissing);
> }
> catch (Exception varE)
> {
> MessageBox.Show("Error:\n" + varE.Message, "Error message");
> }
> }
>
> "Graham Mayor" wrote:
>
> > In order to convert to a TIF (or any other graphics format) file you would
> > have to use screen capture, or output to a 'printer' driver capable of
> > creating TIF files (such as Microsoft Document Imaging or SnagIt) which
> > would require Word to be open. How you would arrange this from an external
> > programming language I have no idea - a forum for that language would be
> > start.
> >
> > --
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > Graham Mayor - Word MVP
> >
> > My web site www.gmayor.com
> > Word MVP web site http://word.mvps.org
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >
> > vincent wrote:
> > > How to convert a word .doc file into .tif file in c#?
> > > Many thanks for your replying.
> >
> >
> >
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Conversions All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support