掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
エクセルを操作するには? (ID:1681)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
長いのですべては載せませんが、Classを作成しました。 これを利用すると解消できると思います。 もし欲しい場合は直接メール下さい。 添付して送ります。 type TWorkSheet = class private E_WorkSheet: Variant; E_Charts : Variant; FFormat : string; FColor : TColor; FPattern : TPattern; FFont : TFont; FAlign : TAlign; FCol,FRow: integer; function GetCells(ACol, ARow: Integer): Variant; function GetName:string; function GetColor:TColor; function GetPattern:TPattern; function GetFont:TFont; function GetAlign:TAlign; procedure SetCells(ACol, ARow: Integer; const Value: Variant); procedure SetName(NewName:string); procedure SetFormat(NewFormat:string); procedure SetColor(Color:TColor); procedure SetPattern(SelPattern:TPattern); procedure SetFont(Font:TFont); procedure SetAlign(Align:TAlign); function Alpha(I: integer):string; function ExcelRange(Rect:TRect):string; public constructor Create(WorkSheet:Variant); destructor Destroy;override; procedure AutoFit( ColCount:integer ); procedure Activate; procedure PrintPreview; procedure SetHeader( strL,strC,strR:string ); procedure SetFooter( strL,strC,strR:string ); procedure GridToExcel( SG:TStringGrid ); procedure ListToExcel( LV:TListView ); procedure SetStyleCell(Col,Row:integer); procedure SetStyleRect(Rect:TRect); procedure MakeTableTemplate(ColumnRect,ItemRect:TRect; LineWidth:integer); procedure MakeGraph(Rect:TRect ;GraphKind:integer ;HasLegend:Boolean ;Title:string); property Cells[ACol, ARow: Integer]: Variant read GetCells write SetCells; property Name :string read GetName write SetName; property Format :string write SetFormat; property Color :TColor read GetColor write SetColor; property Pattern :TPattern read GetPattern write SetPattern; property Font :TFont read GetFont write SetFont; property Align :TAlign read GetAlign write SetAlign; end; type TExcel = class private E_Excel : Variant; E_Application : Variant; E_WorkBook : Variant; E_Error_Msg : string; public WorkSheets : array of TWorkSheet; //すべてのSheetを配列保持 //ActiveSheet : TWorkSheet; //アクティブなSheetを保持 constructor Create(FileName:string=''); destructor Destroy;override; procedure ExcelClose; procedure SaveAs(FileName:string;FileFormatType:integer); // function GetSheetsCount:integer; // ErrorMessage参照の為のproperty property ErrorMsg : string read E_Error_Msg; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.