|
-
August 18th, 2004, 07:42 PM
#16
Thanks a lot Tom
I could not get to the whole thread from the link you had in the your reply,
Anyways I tried that but still it prints the whole **** document.
I am using
myDoc.PrintOut(covTrue, // Background.
covFalse,//covOptional, // Append.
COleVariant((long)5),//covOptional, // Range.
covOptional, // OutputFileName.
covOptional, // // From.
covOptional, // // To.
covOptional, // Item.
COleVariant(numCps), // Copies.
COleVariant(_T("2,3")),//covOptional, // Pages.
covOptional, // PageType.
covOptional, // PrintToFile.
covOptional, // Collate.
covOptional, // ActivePrinterMacGX.
covOptional, // ManualDuplexPrint.
covOptional, // PrintZoomColumn New with Word 2002
covOptional, // PrintZoomRow ditto
covOptional, // PrintZoomPaperWidth ditto
covOptional);
I have to use COleVariant(_T("2,3")) as COleVariant("2,3") gave the error:: error C2440: 'type cast' : cannot convert from 'char [4]' to 'class COleVariant'
I am opening the document like this word: ocuments myDocs = myWord.GetDocuments();
myDoc= myDocs.Open(COleVariant(szFileName),
covFalse,covTrue,covFalse,covOptional,covOptional,covFalse,covOptional,
covOptional,covOptional,covOptional,covTrue);
Thanks for your time!
Pauli
-
August 18th, 2004, 10:50 PM
#17
I tried this on my home machine with office XP and tried out your printout command.
It printed out pages 2 and 3 alone after I changed the 5 to a 4 as below.
I always rewrite the Open method so that it has only one argument which is why my open looks different.
_Application objWord;
COleVariant covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
if (!objWord.CreateDispatch("Word.Application.10"))
{
AfxMessageBox("Couldn't get Word object.");
return;
}
objWord.SetVisible(TRUE); //This shows the application.
Documents docs(objWord.GetDocuments());
_Document myDoc;
long numCps;
numCps=1;
myDoc=docs.Open(COleVariant("c:\\test.doc"));
myDoc.PrintOut(covTrue, // Background.
covFalse,//covOptional, // Append.
COleVariant((long)4),//covOptional, // Range.
covOptional, // OutputFileName.
covOptional, // // From.
covOptional, // // To.
covOptional, // Item.
COleVariant((long)numCps), // Copies.
COleVariant(_T("2,3")),//covOptional, // Pages.
covOptional, // PageType.
covOptional, // PrintToFile.
covOptional, // Collate.
covOptional, // ActivePrinterMacGX.
covOptional, // ManualDuplexPrint.
covOptional, // PrintZoomColumn New with Word 2002
covOptional, // PrintZoomRow ditto
covOptional, // PrintZoomPaperWidth ditto
covOptional);
Verere testudinem! (Fear the turtle)
Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein
Robots are trying to steal my luggage.
-
August 19th, 2004, 02:44 AM
#18
Can you please post your sample project
As there seems to be something that I am missing.
I did try this time with a new project just to try it out, but still the same , prints all pages..
Thanks for your help.. a lot
Pauli
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|