Главная страница
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.037 c
1-79758
человек в сети
2004-02-12 00:55
2004.02.25
подскажите пожалуйста, как


14-80191
J_S
2004-01-31 00:50
2004.02.25
Как правильно задавать вопросы


1-79767
Alex732
2004-02-11 11:01
2004.02.25
как узнать, сколько осталось времени до события onTimer


3-79627
3APA3A
2004-01-31 00:10
2004.02.25
Первый символ строки...


1-79769
jiurajhgjhgty
2004-02-11 21:21
2004.02.25
Что делать!!! Программа не загружается.