Copiare e spostare fogli di lavoro in Ruby

Aspose.Cells - Copia e spostamento fogli di lavoro

Copia i fogli di lavoro all’interno di una cartella di lavoro

Per copiare il foglio di lavoro utilizzandoAspose.Cells for Java in Rubino , chiamatacopy_worksheet metodo difogli di lavoro modulo. Di seguito puoi vedere un esempio di codice.

Codice Rubino

 def copy_worksheet(workbook)

    # Create a Worksheets object with reference to the sheets of the Workbook.

    sheets = workbook.getWorksheets()

    # Copy data to a new sheet from an existing sheet within the Workbook.

    sheets.addCopy("Sheet1")

    # Saving the modified Excel file in default (that is Excel 2003) format

    workbook.save(@data_dir + "Copy Worksheet.xls")

    puts "Copy worksheet, please check the output file."

end 

Sposta i fogli di lavoro all’interno di una cartella di lavoro

Per spostare il foglio di lavoro utilizzandoAspose.Cells for Java in Rubino , chiamatamove_worksheet metodo difogli di lavoro modulo. Di seguito puoi vedere un esempio di codice.

Codice Rubino

 def move_worksheet(workbook)

    # Get the first worksheet in the book.

    sheet = workbook.getWorksheets().get(0)

    # Move the first sheet to the third position in the workbook.

    sheet.moveTo(2)

    # Saving the modified Excel file in default (that is Excel 2003) format

    workbook.save(@data_dir + "Move Worksheet.xls")

    puts "Move worksheet, please check the output file."

end 

Scarica il codice in esecuzione

Scaricamento**Copiare e spostare fogli di lavoro (Aspose.Cells)**da uno qualsiasi dei siti di social coding sotto indicati: