Specifically - I am trying to send a .DOC file to a FAX using C#.NET Office Automation (COM Microsoft Word 11.0 Object Library), so far I have the following:
My problem is pretty simple - when I run this code I am unable to select which PRINTER I want to print to, it seems to automatically send it to the default Printer defined in Windows.
So, what I need to do is:
a) Select the FAX PRINTER (as opposed to the default printer), I don't force the user to change defaults when using this application
b) Define the Fax Properties (such as Phone Number, etc...) so the user isn't prompted to fill it in
Is there anyway to automate this in C#.NET Office Automation using the COM object?
Thanks,
Code:
Word.ApplicationClass wordApp = null;
private bool SendFax()
{
object missingValue = Type.Missing;
object myTrue = true;
object oFaxFile = sFaxFile;
wordApp = new Word.ApplicationClass();
Word.Document doc = wordApp.Documents.Open(ref oFaxFile,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue,
ref missingValue, ref missingValue, ref missingValue);
FaxOutDoc(doc);
doc.Close(ref missingValue, ref missingValue, ref missingValue);
return true;
}
private bool FaxOutDoc(Word.Document doc)
{
object myTrue = true;
object myFalse = false;
object missingValue = Type.Missing;
object range = Word.WdPrintOutRange.wdPrintCurrentPage;
object items = Word.WdPrintOutItem.wdPrintDocumentContent;
object copies = "1";
object pages = "1";
object pageType = Word.WdPrintOutPages.wdPrintAllPages;
doc.PrintOut(ref myTrue, ref myFalse, ref range,
ref missingValue, ref missingValue, ref missingValue,
ref items, ref copies, ref pages, ref pageType, ref myFalse,
ref myTrue, ref missingValue, ref myFalse, ref missingValue,
ref missingValue, ref missingValue, ref missingValue);
return true;
}
My problem is pretty simple - when I run this code I am unable to select which PRINTER I want to print to, it seems to automatically send it to the default Printer defined in Windows.
So, what I need to do is:
a) Select the FAX PRINTER (as opposed to the default printer), I don't force the user to change defaults when using this application
b) Define the Fax Properties (such as Phone Number, etc...) so the user isn't prompted to fill it in
Is there anyway to automate this in C#.NET Office Automation using the COM object?
Thanks,