BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Import an Image in Excel

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Hubert Rétif
Guest





PostPosted: Wed Jun 08, 2005 7:28 am    Post subject: Import an Image in Excel Reply with quote



Hi,

I am using TExcelApplication to export some Data from my Application to
Excel and it works quite fine.

Now I would like to place an image (jpeg) in the worksheet where the data
are.

How can I do this?

Here the kind of code I am using now:

// Start a new instance
m_ExcelIntf := TExcelApplication.Create( nil );

m_ExcelIntf.SheetsInNewWorkBook[0] := 1;

// Create a new workbook
m_Workbook := m_ExcelIntf.Workbooks.Add(Null, 0);
// Activate the workbook
m_Workbook.Activate(0);

// set sheet names and title
m_WorkSheet[ind] := (m_Workbook.Sheets.Item[ind] as _WorkSheet);
m_WorkSheet[ind].Name := SOFTW_NAME + Grid.Name;
m_WorkSheet[ind].Range['A1','A1'].Value := tempstr;

with Table do
begin
m_WorkSheet[ind].Range['A1','A1'].Value :=
FieldByName('constr_name').AsString + ' ' +

FieldByName('model_name').AsString;
m_WorkSheet[ind].Range['A1','A1'].Font.Size := 16;
m_WorkSheet[ind].Range['A1','A1'].Font.Bold := True;

.......

end;

m_WorkSheet[ind].Range[ 'A1',col+IntToStr(RowIndex-1) ].AutoFormat(

xlRangeAutoFormatList3,True,True,True,True,True,True);
m_WorkSheet[ind].PageSetup.Orientation := xlLandscape;
m_WorkSheet[ind].PageSetup.Zoom := False;
m_WorkSheet[ind].PageSetup.FitToPagesWide := 1;
m_WorkSheet[ind].PageSetup.FitToPagesTall := integer(trunc(rowIndex / 40))
+ 1;

Thanks,
Hubert.


Back to top
Mike Shkolnik
Guest





PostPosted: Wed Jun 08, 2005 12:20 pm    Post subject: Re: Import an Image in Excel Reply with quote



You may insert the image so:
m_WorkSheet[ind]..Shapes.AddPicture('c:aaa.bmp',
True , // LinkToFile
True , // SaveWithDocument
10 , // Left
90 , // Top
90 , // Width
90); // Height

--
With best regards, Mike Shkolnik
EMail: [email]mshkolnik (AT) scalabium (DOT) com[/email]
http://www.scalabium.com

"Hubert Rétif" <retif.hubert (AT) hispeed (DOT) take.this.away.ch> wrote

Quote:
Hi,

I am using TExcelApplication to export some Data from my Application to
Excel and it works quite fine.

Now I would like to place an image (jpeg) in the worksheet where the data
are.

How can I do this?

Here the kind of code I am using now:

// Start a new instance
m_ExcelIntf := TExcelApplication.Create( nil );

m_ExcelIntf.SheetsInNewWorkBook[0] := 1;

// Create a new workbook
m_Workbook := m_ExcelIntf.Workbooks.Add(Null, 0);
// Activate the workbook
m_Workbook.Activate(0);

// set sheet names and title
m_WorkSheet[ind] := (m_Workbook.Sheets.Item[ind] as _WorkSheet);
m_WorkSheet[ind].Name := SOFTW_NAME + Grid.Name;
m_WorkSheet[ind].Range['A1','A1'].Value := tempstr;

with Table do
begin
m_WorkSheet[ind].Range['A1','A1'].Value :=
FieldByName('constr_name').AsString + ' ' +

FieldByName('model_name').AsString;
m_WorkSheet[ind].Range['A1','A1'].Font.Size := 16;
m_WorkSheet[ind].Range['A1','A1'].Font.Bold := True;

.......

end;

m_WorkSheet[ind].Range[ 'A1',col+IntToStr(RowIndex-1) ].AutoFormat(

xlRangeAutoFormatList3,True,True,True,True,True,True);
m_WorkSheet[ind].PageSetup.Orientation := xlLandscape;
m_WorkSheet[ind].PageSetup.Zoom := False;
m_WorkSheet[ind].PageSetup.FitToPagesWide := 1;
m_WorkSheet[ind].PageSetup.FitToPagesTall := integer(trunc(rowIndex /
40))
+ 1;

Thanks,
Hubert.





Back to top
Hubert Rétif
Guest





PostPosted: Wed Jun 08, 2005 2:28 pm    Post subject: Re: Import an Image in Excel Reply with quote



Thanks a lot Mike...

May be you have also an answer for my newest thread?...

Hubert.

"Mike Shkolnik" <mshkolnik2002 (AT) ukr (DOT) net> schrieb im Newsbeitrag
news:42a6e29a (AT) newsgroups (DOT) borland.com...
Quote:
You may insert the image so:
m_WorkSheet[ind]..Shapes.AddPicture('c:aaa.bmp',
True , // LinkToFile
True , // SaveWithDocument
10 , // Left
90 , // Top
90 , // Width
90); // Height

--
With best regards, Mike Shkolnik
EMail: [email]mshkolnik (AT) scalabium (DOT) com[/email]
http://www.scalabium.com

"Hubert Rétif" <retif.hubert (AT) hispeed (DOT) take.this.away.ch> wrote in message
news:42a69eaa (AT) newsgroups (DOT) borland.com...
Hi,

I am using TExcelApplication to export some Data from my Application to
Excel and it works quite fine.

Now I would like to place an image (jpeg) in the worksheet where the
data
are.

How can I do this?

Here the kind of code I am using now:

// Start a new instance
m_ExcelIntf := TExcelApplication.Create( nil );

m_ExcelIntf.SheetsInNewWorkBook[0] := 1;

// Create a new workbook
m_Workbook := m_ExcelIntf.Workbooks.Add(Null, 0);
// Activate the workbook
m_Workbook.Activate(0);

// set sheet names and title
m_WorkSheet[ind] := (m_Workbook.Sheets.Item[ind] as _WorkSheet);
m_WorkSheet[ind].Name := SOFTW_NAME + Grid.Name;
m_WorkSheet[ind].Range['A1','A1'].Value := tempstr;

with Table do
begin
m_WorkSheet[ind].Range['A1','A1'].Value :=
FieldByName('constr_name').AsString + ' ' +

FieldByName('model_name').AsString;
m_WorkSheet[ind].Range['A1','A1'].Font.Size := 16;
m_WorkSheet[ind].Range['A1','A1'].Font.Bold := True;

.......

end;

m_WorkSheet[ind].Range[ 'A1',col+IntToStr(RowIndex-1) ].AutoFormat(

xlRangeAutoFormatList3,True,True,True,True,True,True);
m_WorkSheet[ind].PageSetup.Orientation := xlLandscape;
m_WorkSheet[ind].PageSetup.Zoom := False;
m_WorkSheet[ind].PageSetup.FitToPagesWide := 1;
m_WorkSheet[ind].PageSetup.FitToPagesTall := integer(trunc(rowIndex /
40))
+ 1;

Thanks,
Hubert.







Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot 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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.