Clone a sheet. Return a copy of the original sheet.
1 excel.Workbook.cloneSheet
<excel.Workbook.cloneSheet index='index'>
<wb /> +
</excel.Workbook.cloneSheet>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aindex | integer | Index of the original sheet. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Ewb | Workbook | Worksheet which contains the sheet to clone. |
Returns | |
---|---|
Type | Description |
Sheet | Sheet which has been created. |
Example
Create a sheed from another.
Copy
<xsql-script> <body> <set name='wb'> <excel.Workbook /> </set> <set name='sheet_1'> <excel.Workbook.createSheet name='Sheet1'> <wb /> </excel.Workbook.createSheet> </set> <set name="cell_r2c5"> <excel.Sheet.createCell row="5" col="5"> <sheet_1/> </excel.Sheet.createCell> </set> <excel.Cell.setCellValue> <cell_r2c5/> <string>TEST 100</string> </excel.Cell.setCellValue> <!-- Clone the sheet 0 --> <set name='m_new_sheet'> <excel.Workbook.cloneSheet index='0'> <wb /> </excel.Workbook.cloneSheet> </set> <!-- Get the last number of sheet --> <set name='m_last_sheet'><sub><excel.Workbook.getNumberOfSheets><wb /></excel.Workbook.getNumberOfSheets>1</sub></set> <!-- Change the name of the cloned sheet --> <excel.Workbook.setSheetName index='#m_last_sheet' name='Sheet1 (clone)'> <wb /> </excel.Workbook.setSheetName> <excel.Workbook.write> <wb/> <file name="test.xls" type="absolute"/> </excel.Workbook.write> </body> </xsql-script>