Clipboard formatted text lazarus / 34-Windows ---------------------------------------------------------------------- Paolo · 2021-07-11 17:16 The attempt is to copy text in clipboard with "Tab" separator for successive Ctrl+V in word document, then selecting it inside Word add a grid around that text. I did the code below and this works Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  StrGrdExc : TStringGrid; procedure TFrmMain.ToolButton4Click(Sender: TObject);var  iR, iC : integer;  Str1 : string;begin  Clipboard.AsText:='';  for iR:=1 to StrGrdExc.RowCount-1 do begin    Str1:='';    for iC:=1 to StrGrdExc.ColCount-1 do begin      Str1:=Str1+StrGrdExc.Cells[iC, iR];      if iC <> StrGrdExc.ColCount-1 then        Str1:=Str1+#9    end;    Clipboard.AsText:=Clipboard.AsText+Str1+#13#10;  end;end;   is that the right way to do that ? (Windows 10, LAZ 2.0.12, FPC 3.0.2) thank you in advance. ---------------------------------------------------------------------- wp · 2021-07-11 17:21 I would use a temporary string variable rather than repeatedly calling Clipboard.AsText. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFrmMain.ToolButton4Click(Sender: TObject);var  clipboardStr: String;  ...begin  clipboardStr := '';  for iR := 1 to StdGrdExc.RowCount-1 do begin    ...    clipboardStr := clipboardStr + Str1 + LineEnding;  end;  Clipboard.AsText := clipboardStr;end; ---------------------------------------------------------------------- Paolo · 2021-07-11 17:29 thanks, the updated code working perfectly. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  procedure TFrmMain.ToolButton4Click(Sender: TObject);var  iR, iC : integer;  Str1 : string;begin  Str1:='';  for iR:=1 to StrGrdExc.RowCount-1 do begin    for iC:=1 to StrGrdExc.ColCount-1 do begin      Str1:=Str1+StrGrdExc.Cells[iC, iR];      if iC <> StrGrdExc.ColCount-1 then        Str1:=Str1+#9    end;    Str1:=Str1+LineEnding;  end;  ClipBoard.AsText:=Str1end;