示例#1
0
def test3():
    myExcel = ABKExcel()  #create a object
    myExcel.open(r'C:\Users\hp\Desktop\ABKTt.xls')  #open a Excel File
    sheet_name_list = myExcel.get_sheet_names()

    for name in sheet_name_list:
        myExcel.ReadOn()
        myExcel.readsheets(name)
        sheet = myExcel.getSheetByName(name)
        Tables = sheet.getTables()
示例#2
0
def test2():
    table_col = 9
    table_row = 9
    col_span = 2
    row_span = 2

    table = ABKTable(row_span,col_span,table_row,table_col)
    table.initStyleOn()
    table.table_index = row_span

    table.absout_col = col_span

    table.setTitle('Multiple')

    table.setColor(2,2,'rose')		#设置颜色

    table.setMerge(3,5,9,9)			#设置合并格

    #现在有一个问题就是这个数字变成字符串就ok。。。

    fontstyle=['Batang',1,'blue',880]
    table.setFont(8,8,fontstyle) #设置字体

    for irow in xrange(1,table_row+1):
        for icol in xrange(1,table_col+1):
            value = irow*icol
            table.setCellData(irow,icol,value)

    myExcel = ABKExcel() #create a object

    myExcel.open(r'C:\Users\hp\Desktop\ABKTt.xls') #open a Excel File

    name = 'Sheet1'

    myExcel.ReadOn()

    myExcel.readsheets(name)

    sheet = myExcel.getSheetByName(name)

    sheet.insertTable(table,0)

    myExcel.WriteOn()  # 是否允许对这个文件的修改

    # 如果名字重了,就提示是否保存...
    myExcel.save()

    myExcel.close()
示例#3
0
def test1():
    table_col = 9
    table_row = 9
    col_span = 2
    row_span = 2
    abs_col = 2

    table = ABKTable(row_span,col_span,table_row,table_col)

    table.absout_col = abs_col  # index,absoult_col默认为 0

    table.initStyleOn()

    table.setTitle('Multiple')  #设置标题

    table.setColor(2,2,'yellow')		#设置颜色

    table.setMerge(3,3,2,8)			#设置合并格
    table.setMerge(4,4,3,6)
    table.setMerge(5,8,6,6)
    table.setMerge(5,8,3,5)
    #现在有一个问题就是这个数字变成字符串就ok。。。

    fontstyle=['Bell MT',1,'blue',880]

    table.setFont(8,8,fontstyle) #设置字体

    for irow in xrange(1,table_row+1):
        for icol in xrange(1,table_col+1):
            value = irow*icol
            table.setCellData(irow,icol,value)

    sheet = ABKSheet('Book')

    sheet.addTable(table)   #将table添加到sheet中

    myExcel = ABKExcel()

    myExcel.WriteOn()        # 设置可写

    myExcel.open('Multi1.xls')  # 打开文件,如果没有就新建一个文件

    myExcel.addsheet(sheet) #添加sheet到excel中

    myExcel.save()			#保存文件

    myExcel.close()			#关闭文件
示例#4
0
def test3():
    myExcel = ABKExcel() #create a object
    myExcel.open(r'C:\Users\hp\Desktop\ABKTt.xls') #open a Excel File
    sheet_name_list = myExcel.get_sheet_names()

    for name in sheet_name_list:
        myExcel.ReadOn()
        myExcel.readsheets(name)
        sheet = myExcel.getSheetByName(name)
        Tables = sheet.getTables()
示例#5
0
def test2():
    table_col = 9
    table_row = 9
    col_span = 2
    row_span = 2

    table = ABKTable(row_span, col_span, table_row, table_col)
    table.initStyleOn()
    table.table_index = row_span

    table.absout_col = col_span

    table.setTitle('Multiple')

    table.setColor(2, 2, 'rose')  #设置颜色

    table.setMerge(3, 5, 9, 9)  #设置合并格

    #现在有一个问题就是这个数字变成字符串就ok。。。

    fontstyle = ['Batang', 1, 'blue', 880]
    table.setFont(8, 8, fontstyle)  #设置字体

    for irow in xrange(1, table_row + 1):
        for icol in xrange(1, table_col + 1):
            value = irow * icol
            table.setCellData(irow, icol, value)

    myExcel = ABKExcel()  #create a object

    myExcel.open(r'C:\Users\hp\Desktop\ABKTt.xls')  #open a Excel File

    name = 'Sheet1'

    myExcel.ReadOn()

    myExcel.readsheets(name)

    sheet = myExcel.getSheetByName(name)

    sheet.insertTable(table, 0)

    myExcel.WriteOn()  # 是否允许对这个文件的修改

    # 如果名字重了,就提示是否保存...
    myExcel.save()

    myExcel.close()
示例#6
0
def test1():
    table_col = 9
    table_row = 9
    col_span = 2
    row_span = 2
    abs_col = 2

    table = ABKTable(row_span, col_span, table_row, table_col)

    table.absout_col = abs_col  # index,absoult_col默认为 0

    table.initStyleOn()

    table.setTitle('Multiple')  #设置标题

    table.setColor(2, 2, 'yellow')  #设置颜色

    table.setMerge(3, 3, 2, 8)  #设置合并格
    table.setMerge(4, 4, 3, 6)
    table.setMerge(5, 8, 6, 6)
    table.setMerge(5, 8, 3, 5)
    #现在有一个问题就是这个数字变成字符串就ok。。。

    fontstyle = ['Bell MT', 1, 'blue', 880]

    table.setFont(8, 8, fontstyle)  #设置字体

    for irow in xrange(1, table_row + 1):
        for icol in xrange(1, table_col + 1):
            value = irow * icol
            table.setCellData(irow, icol, value)

    sheet = ABKSheet('Book')

    sheet.addTable(table)  #将table添加到sheet中

    myExcel = ABKExcel()

    myExcel.WriteOn()  # 设置可写

    myExcel.open('Multi1.xls')  # 打开文件,如果没有就新建一个文件

    myExcel.addsheet(sheet)  #添加sheet到excel中

    myExcel.save()  #保存文件

    myExcel.close()  #关闭文件