TSWorkbook.CopyWorksheetFrom cells width/height are both lost lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- totya · 2017-01-01 14:41 Hi! I merge many excel files to one excel file with all sheets, with TSWorkbook.CopyWorksheetFrom procedure. It works, but I want to exact copy, but cells width and height information are both lost. I use TsWorkbookSource and TSWorkbookTabControl and TsWorksheetGrid to show the excel file. Thanks! ps.: I remember the UpdateRowHeights procedure, but with TsWorkbookSource/TSWorkbookTabControl/TsWorksheetGrid it doesn't need somehow. I create TsWorksheetGrid  manually after read and process the excel file - reasion is the speedup. ps 2.: merge code about: 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 TForm1.Button1Click(Sender: TObject);var  wb, ws, i: integer;  s: string;   WorkbookSourceTemp: TSWorkbook;  WorkbookDestinationTemp: TSWorkbook;begin  i:=0;  with FilesOpenDialog do    if Execute then    if Files.Count > 0 then        try          WorkbookDestinationTemp:= nil;          WorkbookDestinationTemp:= TSWorkbook.Create;           for wb:= 0 to FilesOpenDialog.Files.Count-1 do          begin            try            WorkbookSourceTemp:= nil;              WorkbookSourceTemp:= TSWorkbook.Create;               WorkbookSourceTemp.ReadFromFile(FilesOpenDialog.Files[wb]);             RemoveEmptyWorksheets(WorkbookSourceTemp);               for ws := 0 to WorkbookSourceTemp.GetWorksheetCount() - 1 do               begin                 inc(i);                  s:=                   IntToStr(i)+                   '. '+                   WorkbookSourceTemp.GetWorksheetByIndex(ws).Name;                  while Length(s) > c_ExcelWorksheetNameMaxLength do                   Delete(s, Length(s), 1);                  WorkbookSourceTemp.GetWorksheetByIndex(ws).Name:= s;                  WorkbookDestinationTemp.CopyWorksheetFrom(WorkbookSourceTemp.GetWorks heetByIndex(ws));               end;             finally              if Assigned(WorkbookSourceTemp)                then FreeAndNil(WorkbookSourceTemp);            end;          end;         WorkbookDestinationTemp.WriteToFile(MyFile.ExcelMergedTemp, sfOOXML, true);         finally          if Assigned(WorkbookDestinationTemp)          then FreeAndNil(WorkbookDestinationTemp);        end; end; ---------------------------------------------------------------------- wp · 2017-01-02 09:12 The CopyWorksheetFrom in the new revision includes also copying of column and row records. ---------------------------------------------------------------------- totya · 2017-01-02 18:12 Thank you for your job! For me it doesn't work correctly with UTF8 chars, because row heights are wrong, and the font size is bigger than normal. After some time, I created a sample file, see attached file. ---------------------------------------------------------------------- wp · 2017-01-02 18:52 What are you doing? I copied the worksheet using this code 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 program copyworksheet_demo; uses  fpspreadsheet, laz_fpspreadsheet, xlsbiff8; var  book: TsWorkbook; begin  book := TsWorkbook.Create;  try    book.ReadFromFile('sample2.xls');    book.CopyWorksheetFrom(book.GetFirstWorksheet, true);    book.WriteToFile('sample2-copy.xls', true);  finally    book.Free;  end;end.Spready displays the copied sheet identically to the original sheet. ---------------------------------------------------------------------- totya · 2017-01-02 18:55 Hi! My code see the first message. I see the differents is the different save format: 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  WorkbookDestinationTemp.WriteToFile(MyFile.ExcelMergedTemp, sfOOXML, true); EDIT.: But not is the problem, the merged file show badly in Spready too, see attached file. ---------------------------------------------------------------------- wp · 2017-01-03 00:14 Ah, the problem is when copying a sheet from another workbook into the current workbook. Should be better now. ---------------------------------------------------------------------- totya · 2017-01-03 16:29 Quote from: wp on January 03, 2017, 01:14:09 amAh, the problem is when copying a sheet from another workbook into the current workbook. Should be better now. Hi! Very thank you! Yesterday I want to write the cell color problem too with sheet copy, but the current svn code solve this problem too... ps/off: I rent a room, but the owner of this house is idiot, she turn off my internet (wifi/router) many times... I hope the next place will be better....