Help!

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

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Conversions RSS
Next:  Images missing from works file  
Author Message
vincent
External


Since: Nov 02, 2006
Posts: 7



PostPosted: 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
Graham Mayor
External


Since: Jul 04, 2006
Posts: 4676



PostPosted: 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
vincent
External


Since: Nov 02, 2006
Posts: 7



PostPosted: 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
GJ
External


Since: Jun 20, 2007
Posts: 2



PostPosted: 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
Bacem
External


Since: Sep 23, 2009
Posts: 1



PostPosted: 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
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> 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