请问如何在delphi中改变excel的宽度!急急急!!(100分)

  • 主题发起人 主题发起人 yangh
  • 开始时间 开始时间
1. How to Set Font.

var xlSheet: worksheet;
xlRange:Range;
begin
xlSheet:=xlBook.ActiveSheet as WorkSheet;
xlRange:=xlSheet.Range['A1:A3','A1:A3'];
xlRange.Font.Name:='Times New Roman';
xlRange.Font.Size:=16;
xlRange.Font.Bold:=true;
xlRange.Font.Italic:=true;
xlRange.Font.Color:=clBlue;
end;

2. How to Set Column Width

var xlRange: Range;
CWidth: String;
begin
CWidth:=inputBox('Set Width','Enter Width','');
xlRange:=ExcelApp.Get Selection(lcid) as Range;
xlRange.ColumnWidth:=StrToInt(CWidth);
end;

3. How to Set Row Height

var xlRange: Range;
RHeight: String;
begin
RHeight:=inputBox('Set Height','Enter Height','');
xlRange:=ExcelApp.Get Selection(lcid) as Range;
xlRange.RowHeight:=StrToInt(RHeight);
end;

4. how to Draw Border

var xlRange: Range;
begin
xlRange:=ExcelApp.Get Selection(lcid) as Range;
xlRange.Borders.Item[xlBottom].LineStyle:=xlContinuous;
{ LineStyle Const.
xlContinuous = $00000001;
xlDash = $FFFFEFED;
xlDashDot = $00000004;
xlDashDotDot = $00000005;
xlDot = $FFFFEFEA;
xlDouble = $FFFFEFE9;
xlSlantDashDot = $0000000D;
xlLineStyleNone = $FFFFEFD2
}
xlRange.Borders.Item[xlBottom].Weight:=xlThin;
xlRange.Borders.Item[xlBottom].ColorIndex:=3;
end;
 
后退
顶部