dougu1896 2012-02-03 17:14
浏览 19

PHP:OpenTBS的电子表格摘要?

I'm using the PHP library TinyButStrong with the plugin OpenTBS to merge existing Excel (or OpenOffice Calc) spreadsheets with data from a database.

This works fine, but I can't figure out how to define summaries for a column.

For example , I define cell A1 as the cell that merges with the data. After the merge, rows are inserted for A2, A3, etc.

The problem is that I don't know beforehand how many rows are going to be inserted, so it's not an option to leave 10 rows empty, and define A11 as the summary field, because it could also be 100 rows of data, and I want the summary directly below the last row of data.

Any ideas?

  • 写回答

1条回答 默认 最新

  • douyanjing8287 2012-02-03 22:34
    关注

    OpenTBS is not able to follow a cell when a sheet is merged because any cell can be moved, deleted and duplicated at any time during the merging.

    Nevertheless, I can suggest two solutions.

    Easy solution:

    Decide to place the total above the zone to sum. And use a formula that covers the zone over it can never be.

    Example with an ODS file (OpenOffice Spreadsheet):
    For Excel, replace "odsNum" with "xlsxNum", and "table:table-row" with "row".

    A1: = SUM(A2:A20000)
    A2: [a.amount;block=table:table-row;ope=odsNum]
    

    This way the ODS formula stays correct what ever the block "a" can be extended to.

    Elaborated solution:

    Use a formula that references to the cell just above itself.

    Example with an ODS file (OpenOffice Spreadsheet):
    For Excel, replace "odsNum" with "xlsxNum", and "table:table-row" with "row".

    A1: [a.amount;block=table:table-row;ope=odsNum]
    A2: =SUM( A1 : INDIRECT(ADDRESS(ROW()-1;COLUMN())) )
    

    The same but with a fixed column:

    A1: [a.amount;block=table:table-row;ope=odsNum]
    A2: =SUM( A1 : INDIRECT("A" & (LIGNE()-1))) )
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类