Главная страница
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.019 c
4-80371
DMichael
2003-12-16 10:50
2004.02.25
Процесс от имени другого пользователя


9-79534
Soft
2003-08-15 16:15
2004.02.25
Ламерам-програмерам


9-79522
NailMan
2003-08-11 12:58
2004.02.25
Как сделать переходы между менюшками?


4-80365
zdn
2003-12-17 13:14
2004.02.25
Подключение к запущенному процесус


1-79995
VID
2004-02-11 23:54
2004.02.25
Удаление всех TRadioButtons с html-страницы