Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.02.25;
Скачать: CL | DM;

Вниз

Работа с Excel-ом   Найти похожие ветки 

 
AleksandrKu   (2004-02-11 15:27) [0]

Как можно выделить ячейку на страничке эксела?
либо изменить шрифт или изменить цвет заливки?


 
clickmaker ©   (2004-02-11 15:34) [1]

Sheet := ExcelApplication.ActiveSheet as _WorkSheet;
Sheet.Range[<диапазон>].Select;
Sheet.Range[<диапазон>].Font := ...


 
AleksandrKu   (2004-02-11 15:39) [2]

Sheet.Range[<диапазон>].Font := ...
<диапазон> как задается? как в самом экселе (D1:f1)?
Шрифт какой можно задать в каком формате?


 
olookin ©   (2004-02-11 15:44) [3]

procedure TEqapExcel.AssignCellFormat(var Value: Variant; CellFormat: TCellFormat);
var V: Variant;
begin
with CellFormat do begin V:=Value.Font; AssignFont(V,Font);
Value.Orientation:=TextRotation; Value.Interior.Pattern:=Pattern;
Value.Interior.PatternColor:=ColorToRGB(PatternColor);
Value.HorizontalAlignment:=xlTextAlignment[integer(HorizTextAlignment)];
Value.VerticalAlignment:=xlTextAlignment[integer(VertTextAlignment)];
Value.ColumnWidth:=Width; Value.RowHeight:=Height; Value.WrapText:=WrapText;
if Color=clNone then Value.Interior.ColorIndex:=xlNone else
Value.Interior.Color:=ColorToRGB(Color); end;
end;

procedure TEqapExcel.AssignFont(var Value: Variant; Font: TFont);
begin
with Font do begin try Value.Name:=Name; Value.Size:=Size;
Value.Bold:=fsBold in Style; Value.Italic:=fsItalic in Style;
Value.Underline:=fsUnderline in Style;
Value.Strikethrough:=fsStrikeOut in Style;
Value.Color:=ColorToRGB(Color);
except on EOleError do end; end;
end;

type TCellFormat = class(TPersistent)
property WrapText: boolean read FWrapText write IsWrapText default false;
property Font: TFont read FFont write SetFont;
property Color: TColor index 1 read FColor write SetColor;
property PatternColor: TColor index 2 read FPatternColor write SetColor;
property Pattern: TPattern read FPattern write SetPattern;
property Width: double index 1 read FWidth write SetValue;
property Height: double index 2 read FHeight write SetValue;
property TextRotation: double index 3 read FRotation write SetValue;
property HorizTextAlignment: TTextAlignment index 1 read FHorizTextAlign
write SetTextAlign;
property VertTextAlignment: TTextAlignment index 2 read FVertTextAlign
write SetTextAlign;
end;

Пример:

V:=Excel.Workbooks[k].Sheets[j].Cells[Row,Col];
AssignCellFormat(V,CellFormat);



Страницы: 1 вся ветка

Текущий архив: 2004.02.25;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.044 c
4-80355
Winni
2003-12-17 20:04
2004.02.25
Как запустить екзешник из ресурса ?


1-79859
anatolyk
2004-02-06 12:45
2004.02.25
Proxies.dcu


1-80000
Checist [root]
2004-02-06 17:22
2004.02.25
Обращение к сылке


3-79618
Pako
2004-02-03 07:36
2004.02.25
Pack


14-80286
jack128
2004-02-01 12:48
2004.02.25
Намагничена, поляризована...