Главная страница
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.04 c
1-79934
SMT
2004-02-09 16:37
2004.02.25
TeeChart компонент


1-79820
romeo
2004-02-10 11:27
2004.02.25
Обработка исключений во время отладки без показа сообщ. об ошибке


1-79738
Val123
2004-02-12 12:33
2004.02.25
RichEdit


1-79763
@G
2004-02-11 17:52
2004.02.25
Защита файла


7-80314
Vitaly Grobshtein
2003-12-04 11:52
2004.02.25
Отключить темы WinXP