Delphi 7 Excel automation [Edit]

None of the main categories make any sense for this post, but Excel is a form of reporting I guess, so I put it here. Fine if you decide to move it. Doesn't matter to me.

In Excel, you can select individual or groups of characters within a cell and modify their characteristics, such as bold, font color, font name, etc. I know how to do this in VBA in Excel and Access. I've tried to apply this idea to some automation I'm doing from within D7 but it's not working. My Excel file is created as expected in every way other than this.

OXL is a variant that is the workbook
oSheet is an variant variable that is the sheet. It works fine for the rest of my code so there's no issue there.
rteNum contains short alphanumeric values such as "ABC123" or "Bob5"
rteNum can also contain special characters that signify certain conditions. So it can also be like "ABC123 *" or "Bob5 #".  
I need the * and the # to be bold red while the rest of the cell stays non bold black. Again, this is easy to do in Excel itself.

      oSheet.Cells[i,2].Select;
      numCellChars := Length(rteNum);
      OXL.ActiveCell.Characters[numCellChars, 1].Font.FontStyle := 'Bold';
      OXL.ActiveCell.Characters[numCellChars, 1].Font.Color := -16776961;

The above code should bold/red the last character of the cell but it does nothing at all. No crash, it runs through each line, but the character does not change.

What's odd is that if I do this:

      OXL.ActiveCell.Characters[1, 1].Font.FontStyle := 'Bold';

the bolding works but it bolds the entire cell, not just the first character. And no matter what I do, the color does not change at all.



EDIT: never mind. dumb mistake on my part. i was setting the value of the cell AFTER all the above code. When I set the cell's value BEFORE the code shown above, it works as needed.

Edited by: Keith Hicks on Jul 20, 2015 9:49 PM
0
Keith
7/21/2015 4:54:11 AM
embarcadero.delphi.reporting 487 articles. 0 followers. Follow

0 Replies
656 Views

Similar Articles

[PageSpeed] 2

Reply:

Similar Artilces:

ANN: Delphi HTML Reports preview
Very simple to use - buid complex reports in 10 minutes. All you need to know - SQL, HTML, CSS. Use all power of HTML4 and CSS3 in any part of report. Features: Barcodes Multiline headers Groups Cross-tabs (any level) Transformations (cross-tab with range) Pictures (+from database) Master/Detail (any level) Supports all databases and db-libraries (writing adapter for any db-acess library takes only 5 minutes) Standalone reports - no need for delphi forms/datasets. 100% native Delhi code. All Delphi versions - from Delphi 6 to XE6 (VCL). 32/64 bit. Supports Unicode for...

Convert Delphi 7 to Delphi 2009 [Edit]
Hi! Please, I have a code done in Delphi 7... Now I want to convert Delphi 7 to Delphi 2009 but I'm having problems when compile the code. Error message: +[DCC Fatal Error] Far.dpr(9): F2063 Could not compile used unit 'System.pas'+ Please can somebody help me? Source Download (349KB): http://rapidshare.com/files/256191328/FileManager.rar.html Mirror Source Download: http://www.megaupload.com/?d=12GYLPT0 Password: delphi Thank u so much! (sorry for my bad english, it is not my native language) Edited by: loquax loquax on Jul 15, 2009 12:24 PM Sorry, bu...

Delphi 7 Excel automation
None of the main categories make any sense for this post, but Excel is a form of reporting I guess, so I put it here. Fine if you decide to move it. Doesn't matter to me. In Excel, you can select individual or groups of characters within a cell and modify their characteristics, such as bold, font color, font name, etc. I know how to do this in VBA in Excel and Access. I've tried to apply this idea to some automation I'm doing from within D7 but it's not working. My Excel file is created as expected in every way other than this. OXL is a variant that is the workbook oShee...

Delphi 7 to Delphi XE: TBlobField to XML [Edit]
Hi, I'm migrating a Delphi7 application to Delphi XE. I'm using a TClientDataSet to communicate, by using a XML frame, with my server. In this TClientDataSet I'm using a TBlobField which is an array of 384 byte. The blobField is allocate by a code like this : {code} myStream : TStream; myStream := aClientDataSet.CreateBlobStream(myBlobField, bmwrite); vResult := myStream.Write(ArrayOf384Byte[0], length(ArrayOf384Byte)); //vResult = 384 => GooD ! (...) {code} For communicate with the server, we have to decode the Blobfield in XML before to sending it. We have...

Code works in Delphi 7 but not in Delphi 2010 [Edit]
hello, i have a procedure that open's a file by passing the file name as the parameter to the executable. something like this {code} C : \ P r o g r a m F i l e s \ Da c k e r \ D r a c k e r . e x e " G : \ D E l p h i 7 \ D e l p h i 7 A p p _ l o g . t " {code} The source code is {code} procedure OpenFileWithExe var hReg: HKEY; Ret: Longint; RegDataType, RegDataSize: DWORD; CmdLine: array [0..560] of Char; Len: Integer; SInfo: TStartupInfo; PInfo: TProcessInformation; begin Ret := windows.RegOpenKeyEx(HKEY_CURRENT_USER, ...

Automating Excel 4.0 from Delphi 7
I need to write to a Excel 4.0 file and cannot use the Excel97 library. In fact, I cannot do it with Excel 2003 and 2003 SP3 either. All of the above corrupt the file. EXAMPLE: The Excel 4.0 file is 4 kb in size. If I Open and then Save the file, its size increases. It increases to 6 kb w/2003 and 5 kb w/97. I suspect extra overhead from latter Excel versions are being saved in the original file. I suspect the only way to save the file and actually no change it is to use Excel 4.0 for the entire handling. Thanks in advance, Tom ...

Delphi 7 to Delphi XE2
Hi, Still using that old workhorse, Delphi7, but am going to the conference in London hosted by Embarcadero on Delphi XE2. Although I would like to "move with the times" and am keen to get the UNICODE and 64-bit support offered by the latest IDEs, I confess to being more than a little scared about all the UNICODE/String/AnsiString and 32/64 bit issues I'm probably going to fall over. Anyone recently upgraded from Delphi7 to one of the latest Delphi IDEs? Thanks, Alain On 03/02/2012 08:55, Alain Dekker wrote: > Still using that old workhorse, Delphi7, but...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi 7 to Delphi XE
Have been using Delphi 7 for many moons ( have got later versions but never upgraded to ) My first problem is: Component Palette. in XE it is a small toolbar docked in top right in Delphi 7 it gives a large view of all the components. I am struggling to be able to cope/access my components.in Delphi XE. Can I make the component pallette tool bar the same size as Delphi 7, or is there a fast way to view/choose all available components in XE, that I have not spotted yet? Kind Regards, Robert. Hi, What I know is that in Delphi 2010 and XE you can choose between t...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi 7 TFontDialog and Windows 7 [Edit]
When using the TFontDialog on a Windows 7 box, it will not list the device fonts (printer fonts). If I launch M$ Word on that same machine, Word will list them fine. This works fine on an XP box. Any ideas? Edited by: Tim Muenstermann on Apr 29, 2010 9:05 AM > {quote:title=Tim Muenstermann wrote:}{quote} > When using the TFontDialog on a Windows 7 box, it will not list the device fonts (printer fonts). If I launch M$ Word on that same machine, Word will list them fine. > What Word does (BTW, M$ went out about a decade ago) makes absolutely no difference. Office ...

I wrote an application and used cracked delphi 7, after i bought delphi 7
I wrote an application and used cracked delphi 7, I sold it, after i bought delphi 7 and recompiled application, is now my application legal or? > {quote:title=Ivan Ivanov wrote:}{quote} > I wrote an application and used cracked delphi 7, I sold it, after i bought delphi 7 and recompiled application, is now my application legal or? "I embezzled some money from my employer, returned the funds, and then got it back as a bonus. Can I still be arrested?" Uhhh .... didn't you just confess to a crime? > {quote:title=Ivan Ivanov wrote:}{quote} > I wrote an appli...

Migrating From Delphi 7 to Delphi 2010
We did not know which forum was the best for this question. We have been wanting to migrate from Delphi 7 to a later version for years but it appears to be a daunting task. We first looked at D2006 and that was a radical new world. We bought D2010 a couple of years ago and not done much with it because there are so many parts to our applications. We have done a few new applications in D2010 and they seem to work okay. D2010 has not been impressive, perhaps because of the strangeness compared to D7. Is is possible for us to do a phased sort of migration where we do a form at a time? ...

Migrating from Delphi 7 to Delphi XE3
Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. I was wondering if there is a good book or reference to learn all new things XE3 added. Any suggestions? On 5/3/2013 10:17 PM, George Karatsiolis wrote: > Hello, Its time to leave the old Delphi 7 and move to the new (but not the latest) XE3. > I was wondering if there is a good book or reference to learn all new things XE3 added. Try this one for starters: http://tinyurl.com/cgsu243 Aside from that you really need to evaluate your application. XE3 is Unicode for example.... So her...

Web resources about - Delphi 7 Excel automation [Edit] - embarcadero.delphi.reporting

Automation - Wikipedia, the free encyclopedia
For a hierarchical presentation of automation topics, see Outline of automation . For other uses, see Automation (disambiguation) . Automation ...

Automation World - Covering the field of industrial automation
AutomationWorld.com delivers content for the Automation Buying team, which includes Information Technology and Networking; Operations and Engineering; ...

Facebook Ads API Partner AdStage: Campaign Automation, $6.25M Series A Funding
AdStage , a Facebook ads API partner, announced Wednesday the launch of campaign automation — as well as a $6.25 million round of Series A funding. ...

Mind blown! Facebook’s f8 makes a mobile move into marketing automation
... Thus, you’ll need to build a mobile app (if you’re enterprise) or use an app-building platform (such as GroSocial). The marketing automation ...

Automation Heroes (@automationhero) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Automation World
Automation World is your link to the why and how of manufacturing automation. The purpose of this group is to connect manufacturing engineers,... ...

Samsung SmartThings Home Monitoring Kit offers easy automation
Home automation and monitoring is getting easier than ever. The days when you had to hire a contractor to wire up your home for security or to ...

Is home automation in your future or are you using it now?
Home automation gets touted by some as the future, but it's really the now. A seemingly endless list of products are on the market and they allow ...

3 Growing Digital Trends for 2016: Automation, Personalization, Gamification.
1. Marketing Automation What is it? Marketing automation is a category of technology that allows companies to streamline, automate, and measure ...

Edimax lands networking device orders for production automation
... device maker Edimax Technology has obtained orders from US-based clients for about 25,000 wireless networking devices used in production automation, ...

Resources last updated: 1/8/2016 3:23:20 AM