Board index » delphi » Search for placeholder in Excel

Search for placeholder in Excel


2004-06-27 06:49:47 PM
delphi21
Hi
I'm writing an application which has to export some date from a database to
excel. The application is using a excel template which the customer should
be able to modify them self. So I need to define som placeholders (e.g. $A,
$B.. $Z) which I will have to search for and replace with the exported data.
I need to be able to search across the workbook (multiple worksheets).
Does anyone have a good solution for that? I using D6.
regards
Henry
 
 

Re:Search for placeholder in Excel

How about building a definable map (sort of like placeholders) between
Columns and DB Fields:
Col1 -- DBField1
Col2 -- DBFiedl2
...
then process a DBField by referring back to the Column index and Cells(i,
j). Will only work for flat table though.
James.
"Henrik Nedergaard" <XXXX@XXXXX.COM>writes
Quote
Hi

I'm writing an application which has to export some date from a database
to
excel. The application is using a excel template which the customer should
be able to modify them self. So I need to define som placeholders (e.g.
$A,
$B.. $Z) which I will have to search for and replace with the exported
data.
I need to be able to search across the workbook (multiple worksheets).

Does anyone have a good solution for that? I using D6.

regards
Henry


 

Re:Search for placeholder in Excel

How about building a definable map (sort of like placeholders) between
Quote
Columns and DB Fields:

Col1 -- DBField1
Col2 -- DBFiedl2
...

then process a DBField by referring back to the Column index and Cells(i,
j). Will only work for flat table though.

Hi James
Unfortunately it not a flat table, I have several Blobs stored.
regards
Henry
 

Re:Search for placeholder in Excel

Correct me if I am wrong: I am not sure Excel can take any Blob data. The
Cells would not even take a string with line break in it.
You can display Blob data in other Delphi controls though in response to
TExcelWorksheet SelectionChange event.
"Henrik Nedergaard" <XXXX@XXXXX.COM>writes
Quote
How about building a definable map (sort of like placeholders) between
>Columns and DB Fields:
>
>Col1 -- DBField1
>Col2 -- DBFiedl2
>...
>
>then process a DBField by referring back to the Column index and
Cells(i,
>j). Will only work for flat table though.
>
Hi James

Unfortunately it not a flat table, I have several Blobs stored.

regards
Henry


 

Re:Search for placeholder in Excel

"James" <XXXX@XXXXX.COM>writes
Quote
Correct me if I am wrong: I am not sure Excel can take any Blob data.
The
Cells would not even take a string with line break in it.

You can display Blob data in other Delphi controls though in response to
TExcelWorksheet SelectionChange event.


James, your probably not wrong, I am not trying to export bobls directly.
I'm looking for a search function - the rest I can handle.
regards
Henry
 

Re:Search for placeholder in Excel

Quote
I'm writing an application which has to export some date from a database
to
excel. The application is using a excel template which the customer should
be able to modify them self. So I need to define som placeholders (e.g.
$A,
$B.. $Z) which I will have to search for and replace with the exported
data.
I need to be able to search across the workbook (multiple worksheets).

Does anyone have a good solution for that? I using D6.
Names? These are predefined Ranges. If you go into Excel and type
Insert|Name|Define you can specify a Name and the range it represents. eg
you could insert "PlaceHolder1" as "A1" and then say
ActiveWorkBook.Range("PlaceHolder1").Value=Table1Field1.AsString; and that
would set the value.
Oliver Townshend