Forum > FPSpreadsheet

fpspread copyWorksheet and copyRows

<< < (2/3) > >>

New revision in svn:
- "Dupliate worksheet" error message of Workbook.AddWorksheet
- Make the optional parameter of Workbook.CopyWorksheetFrom a mandatory one.

Hi wp master!

I have an heavily formatted worksheet with data (by Excel), and this is the "formatting and data sample" for the other worksheet. This worksheet name is "sample". I need 10-20 copy from this worksheet to the one new workbook, with new own names.

Workbook.CopyWorksheetFrom sounds good, but I need the optional "new worksheet name" or similar parameter, if possible. Thank you :)

Can't you just rename the copied worksheet after copying?

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  workbook: TsWorkbook;  old_worksheet: TsWorksheet;  new_worksheet: TsWorksheet;  new_Name: String;...  new_worksheet := workbook.CopyWorksheetFrom(old_worksheet, true);  if workbook.ValidWorksheetName('something_else') then    new_worksheet.Name := 'something_else'  else    ShowMessage('Invalid worksheet name.');

Thank you master!

But I noticed a problem (I tried office xlsx format only) the copied worksheet column width isn't equal with the original worksheet column width. This is mean the column width information lost.

I checked the code, and it really seems to copy everything. And the attached demo verifies this.


[0] Message Index

[#] Next page

[*] Previous page

Go to full version