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 

Excel replace string

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





PostPosted: Mon Sep 19, 2005 3:20 pm    Post subject: Excel replace string Reply with quote



Hi all,

I have this code :

ExcelApp.Connect;
ExcelApp.Workbooks.Open('test.xls', EmptyParam, EmptyParam, EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, 0);
ExcelApp.Visible[0] := True;

ExcelSheet.ConnectTo(ExcelApp.Sheets[1] as _worksheet);
ExcelSheet.UsedRange[0].Replace('#test#', '01/01/2005', xlPart, xlByRows,
False, False);

I have this problem: when i replace the string in a cell, i lose any
formatting, font and other cell
properties...why ? there is another way to make this ?

Thank's in advanced for answer.
Marco.Italy


Back to top
George Birbilis
Guest





PostPosted: Tue Sep 20, 2005 9:05 am    Post subject: Re: Excel replace string Reply with quote



I think you shouldn't just set a string to the cell, but set the "Text"
property (or maybe called "Value") of the cell so that you keep the
formatting

-----
George Birbilis (birbilis (AT) kagi (DOT) com)
Microsoft Most Valuable Professional
MVP J# for 2004 & 2005
http://www.kagi.com/birbilis
QuickTime, Delphi, ActiveX, .NET, IPC
--------------
"balin" <balin (AT) xxx (DOT) it> wrote

Quote:
Hi all,

I have this code :

ExcelApp.Connect;
ExcelApp.Workbooks.Open('test.xls', EmptyParam, EmptyParam, EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, 0);
ExcelApp.Visible[0] := True;

ExcelSheet.ConnectTo(ExcelApp.Sheets[1] as _worksheet);
ExcelSheet.UsedRange[0].Replace('#test#', '01/01/2005', xlPart, xlByRows,
False, False);

I have this problem: when i replace the string in a cell, i lose any
formatting, font and other cell
properties...why ? there is another way to make this ?

Thank's in advanced for answer.
Marco.Italy





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.