掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ExcelApplication利用で時間がかかる。 (ID:27467)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
HOta様 早速ありがとうございます。 ソースは下記の通りです。よろしくお願いいたします。 procedure TfrmExMain.UtiwakeCopy(Sender: TObject); var exCol : char; iRow,iCol, IR,R, n: integer; tmp : variant; str : string; begin if ExcelApplication2.Visible[GetUserDefaultLCID] then ExcelWorksheet2.ConnectTo(ExcelWorkbook2.Worksheets['内訳書'] as _worksheet); ExcelWorksheet2.Select; ExcelWorksheet2.Range['A3','A3'].Select; IR := 1; tmp := 0; Clipboard.AsText := ''; for iRow := 1 to exR do begin for iCol := 1 to exC do begin exCol := Chr(Ord('A') + (iCol - 1)); if Data[iRow, iCol] <> '' then tmp := Data[iRow, iCol]; if Data[iRow, iCol] = '' then str := '' else str := string(tmp); if (iRow mod 21) = 0 then str := ''; if length(tmp) >10 then ExcelApplication2.ActiveWindow.ActiveCell.Range[exCol + IntToStr(iRow), exCol + IntToStr(iRow)].WrapText := True; Clipboard.AsText := Clipboard.AsText + str; if iCol < 7 then Clipboard.AsText := Clipboard.AsText + #9 else Clipboard.AsText := Clipboard.AsText + #13#10; end; if (iRow mod 21) = 0 then begin R := IR + Trunc(IR/21) - 21; ExcelApplication2.ActiveWindow.ActiveCell.Cells.Item[R,1].pasteSpecial; Clipboard.AsText := ''; end; IR := IR + 1; end; finalize(Data); end; 尚、折り返しは+#10を使うと下のセルに移るようでしたので、リストのままとしています。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.