以下是原代碼,不知為什麼粘貼上去後在excel當中看不到任何不同一個就是一個但是在預覽當中卻有兩個我粘貼的內容。而且是接著的。。
if (j=3) and not query3.Eof then
      begin
   
      excelworksheet1.Range['a9','l9'].Copy(EmptyParam);
 
      excelworksheet1.Range[excelworksheet1.Cells.Item[d1+8,1],excelworksheet1.Cells.Item[d1+8,12]].Select;
      excelworksheet1.Paste;
      excelworksheet1.Range[excelworksheet1.Cells.Item[d1+8,1],excelworksheet1.Cells.Item[d1+8,12]].RowHeight:=77.25;
       end;
           end
      else
       begin
      d2:=j mod 3;
      if (((j mod 3)=0) and (j<>3) and (not query3.Eof)) then
       begin
       x:=x+15;       d1:=x;
   
       if (((j mod 3)=0) and not (query3.Eof)) then
       begin       excelworksheet1.Range['a9','l9'].Copy(EmptyParam);
       excelworksheet1.Range[excelworksheet1.Cells.Item[d1+8,1],excelworksheet1.Cells.Item[d1+8,12]].Select;
       excelworksheet1.Paste;
  
       excelworksheet1.Range[excelworksheet1.Cells.Item[d1+8,1],excelworksheet1.Cells.Item[d1+8,12]].RowHeight:=77.25;
       end;
       end;