showmessage(inttostr(row) + ':' + inttostr(column)); // shows active cell position
q6. how do i access directly excel workbook com object?
use excelworkbook property:
showmessage(excelworkbook1.excelworkbook.windows[1].caption); // shows workbook window caption
q7. how do i access directly excel worksheet com object?
use excelworksheet property:
showmessage(inttostr(excelworksheet1.excelworksheet.comments.count)); // shows numer of worksheet comments
q8. how do i access directly excel range com object?
use excelrange property:
showmessage(inttostr(excelrange1.excelrange.rows.count)); // shows numer of range rows
q9. how do i access directly excel chart com object?
use excelchart property:
showmessage(excelchart1.excelchart.charttitle[0].text); // shows chart title
q10. how do i display note indicators?
excelapplication.displaynoteindicators := true;
note indicators are small dots in upper-right corner of cell. they display cell tips for cells containing notes.
q11. how do i print a worksheet?
excelworksheet.printout(
emptyparam, // from
emptyparam, // to
emptyparam, // copies
true, // preview
emptyparam, // active printer
emptyparam, // print to file
emptyparam, // collate
emptyparam); // file name for print to file
q12. how do i copy content and format of cells?
excelrange.filldown; // takes content and format of cells from top row of range and fills other rows from top to bottom
excelrange.fillup; // takes content and format of cells from bottom row of range and fills other rows from bottom to top
excelrange.fillright; // takes content and format of cells from left column of range and fills other columns from left to right
excelrange.fillleft; // takes content and format of cells from right column of range and fills other columns from right to left
q13. how do i set cell borders?
with excelrange.excelrange.borders do
begin
color := clnavy; // navy color
linestyle := xldouble; // double style
end;applicable line styles are: xlcontinuous, xldash, xldashdot, xldashdotdot, xldot, xldouble, xlslantdashdot and xllinestylenone
with excelrange.excelrange.font do
begin
name := 'terminal';
color := clblue;
size := 12;
italic := false;
bold := true;
end;
q15. how do i find and replace some text?
var
findtext: olevariant;
replacetext: olevariant;
replace: olevariant;
findtext := 'a';
replacetext := 'b';
replace := wdreplaceone;
with worddocument1.worddocument.content do
find.execute(findtext, // text to find
emptyparam, // match case
emptyparam, // match whole word
emptyparam, // match wildcards
emptyparam, // match sounds like
emptyparam, // match all word forms