Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Typedef problems Pin
Michael Dunn18-Jan-02 16:36
sitebuilderMichael Dunn18-Jan-02 16:36 
GeneralRe: Typedef problems Pin
Stephen Caldwell18-Jan-02 16:44
Stephen Caldwell18-Jan-02 16:44 
GeneralRe: Typedef problems Pin
Michael Dunn18-Jan-02 16:43
sitebuilderMichael Dunn18-Jan-02 16:43 
GeneralRe: Typedef problems Pin
Nish Nishant18-Jan-02 16:54
sitebuilderNish Nishant18-Jan-02 16:54 
QuestionHow do I write my own stream? Pin
Xavier John18-Jan-02 16:10
Xavier John18-Jan-02 16:10 
AnswerRe: How do I write my own stream? Pin
Christian Graus18-Jan-02 22:51
protectorChristian Graus18-Jan-02 22:51 
GeneralWould anyone give some ideas about DirectShow,thanks !! Pin
MrGao18-Jan-02 16:03
MrGao18-Jan-02 16:03 
GeneralEmbedding Word Automation in My App..But.. _Document.SaveAs... Pin
SoonWon18-Jan-02 15:15
SoonWon18-Jan-02 15:15 
Hi,

I am embedding MSWord In my application, using OLE automation.

Code As Follows


/*******************************************************************
This method encapsulates the process of embedding a Word document
in a View object and automating that document to add text.
*******************************************************************/

//Change the cursor so the user knows something exciting is going
//on.
BeginWaitCursor();

CWordContainerCntrItem* pItem = NULL;
TRY
{
//Get the document associated with this view, and be sure it's
//valid.
CWordContainerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);

//Create a new item associated with this document, and be sure
//it's valid.
pItem = new CWordContainerCntrItem(pDoc);
ASSERT_VALID(pItem);

// Get Class ID for Word document.
// This is used in creation.

CLSID clsid;
if(FAILED(::CLSIDFromProgID(L"Word.Document",&clsid)))
//Any exception will do. You just need to break out of the
//TRY statement.
AfxThrowMemoryException();

// Create the Word embedded item.
if(!pItem->CreateNewItem(clsid))
//Any exception will do. You just need to break out of the
//TRY statement.
AfxThrowMemoryException();

//Make sure the new CContainerItem is valid.
ASSERT_VALID(pItem);

// Launch the server to edit the item.
pItem->DoVerb(OLEIVERB_SHOW, this);

// As an arbitrary user interface design, this sets the
// selection to the last item inserted.
m_pSelection = pItem; // set selection to last inserted item
pDoc->UpdateAllViews(NULL);

//Query for the dispatch pointer for the embedded object. In
//this case, this is the Word document.
LPDISPATCH lpDisp;
lpDisp = pItem->GetIDispatch();

//Add text to the first line of the document
_Document doc;
_Document ActiveDoc;
Selection selection;
_Application app;
PageSetup pagesetup;

_Font font;

//set _Document doc to use lpDisp, the IDispatch* of the
//actual document.
doc.AttachDispatch(lpDisp);


//Then get the document's application object reference.
app = doc.GetApplication();



// From there, get a Selection object for the insertion point.
selection = app.GetSelection();
selection.SetText("This is a good place to say \"Hello World\"");


// Automate setting the values for various properties.
font = selection.GetFont();
font.SetName(_T("Tahoma"));
font.SetSize(12);
selection.SetFont(font);

But SaveAs method is not available ...... Confused | :confused:

_Document oActiveDoc;
oActive = app.GetActiveDocument();

oActive.SaveAs(.....................);

--> Exception Error~!!! Cry | :((
GeneralActiveX scripting engine link error Pin
Neville Franks18-Jan-02 14:10
Neville Franks18-Jan-02 14:10 
GeneralAutomation problems using MFC Pin
Jean Louis18-Jan-02 11:37
Jean Louis18-Jan-02 11:37 
GeneralRe: Automation problems using MFC Pin
moredip18-Jan-02 12:13
moredip18-Jan-02 12:13 
GeneralRe: Automation problems using MFC Pin
Jean Louis18-Jan-02 12:19
Jean Louis18-Jan-02 12:19 
GeneralRe: Automation problems using MFC Pin
Jean Louis18-Jan-02 12:48
Jean Louis18-Jan-02 12:48 
GeneralRe: Automation problems using MFC Pin
moredip18-Jan-02 12:55
moredip18-Jan-02 12:55 
GeneralRe: Automation problems using MFC Pin
Jean Louis18-Jan-02 13:07
Jean Louis18-Jan-02 13:07 
GeneralCArchive >> problems (why won't it take bools?) Pin
moredip18-Jan-02 11:26
moredip18-Jan-02 11:26 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
Michael Dunn18-Jan-02 13:09
sitebuilderMichael Dunn18-Jan-02 13:09 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
moredip18-Jan-02 13:16
moredip18-Jan-02 13:16 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
Michael Dunn18-Jan-02 13:34
sitebuilderMichael Dunn18-Jan-02 13:34 
GeneralRe: CArchive >> problems (why won't it take bools?) Pin
moredip21-Jan-02 5:41
moredip21-Jan-02 5:41 
GeneralXmlToArray Pin
18-Jan-02 9:57
suss18-Jan-02 9:57 
GeneralNetwork monitor Pin
Not Active18-Jan-02 9:51
mentorNot Active18-Jan-02 9:51 
GeneralRe: Network monitor Pin
Joaquín M López Muñoz18-Jan-02 10:17
Joaquín M López Muñoz18-Jan-02 10:17 
GeneralRe: Network monitor Pin
Not Active18-Jan-02 12:14
mentorNot Active18-Jan-02 12:14 
GeneralCWnd text editor Pin
alex.barylski18-Jan-02 8:24
alex.barylski18-Jan-02 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.