Eliminar hojas de cálculo usando el índice de hoja en Jython

Aspose.Cells - Eliminando hojas de cálculo usando el índice de hoja

Para agregar documentos usando Aspose.Cells Java for Jython. Aquí puedes ver código de ejemplo.

Código Jython

 from aspose-cells import Settings

from com.aspose.cells import Workbook

from java.io import FileInputStream;


class RemovingWorksheetsusingSheetIndex:

    def __init__(self):

        dataDir = Settings.dataDir + 'WorkingWithWorksheets/RemovingWorksheetsusingSheetIndex/'



        fstream=FileInputStream(dataDir + "Book1.xls");

        #Instantiating a Workbook object with the stream

        workbook = Workbook(fstream)

        #Removing a worksheet using its sheet index

        workbook.getWorksheets().removeAt(0)

        #Saving the Excel file

        workbook.save(dataDir + "book.out.xls")

        #Closing the file stream to free all resources

        fstream.close()


        #Print Message

        print "Sheet removed successfully."

if __name__ == '__main__':        

    RemovingWorksheetsusingSheetIndex()

Descargar Código en Ejecución

Descargar Agregar documentos (Aspose.Cells) desde cualquiera de los sitios de codificación social mencionados a continuación: