Changing size of embeded Excel worksheet

S

Skelter

Hello,
I create an SDI application based on article
http://support.microsoft.com/kb/311546
"How to embed and automate an Excel worksheet by using MFC..". However, one
problem exist and I cant figure out the way how to solve it. When I change
item size to fit the view:

CExcelView::OnSize(UINT nType, int cx, int cy)
{
CRect rect (0, 0, cx, cy);
CECCntrItem* pActiveItem =
(CECCntrItem*)GetDocument->GetInPlaceActiveItem(this);
pActiveItem->SetItemRects(rect);
}
Size of excel cells changes too, proportionally.
Any way to fix this?
 
C

Cindy M.

Hi =?Utf-8?B?U2tlbHRlcg==?=,
I create an SDI application based on article
http://support.microsoft.com/kb/311546
"How to embed and automate an Excel worksheet by using MFC..". However, one
problem exist and I cant figure out the way how to solve it. When I change
item size to fit the view:

CExcelView::OnSize(UINT nType, int cx, int cy)
{
CRect rect (0, 0, cx, cy);
CECCntrItem* pActiveItem =
(CECCntrItem*)GetDocument->GetInPlaceActiveItem(this);
pActiveItem->SetItemRects(rect);
}
Size of excel cells changes too, proportionally.
Any way to fix this?
Unfortunately, no. What you're changing is the graphic element in Word (like a
picture). The object model exposes no way to change the number of cells of the
embedded Excel sheet "peeking through the window".

The only way I know to control this is to first construct the sheet in Excel,
then import it into Word using InsertObject or by inserting a LINK field with
the \p switch. The window size will adjust to the the number of cells actually
populated with data.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top