locked
Is there a way to reset Table Size (different columns, column count, data) of an existing binding? RRS feed

  • Question

  • We have successfully integrated Apps for Office and it works like a champ updating table bindings.

    However, one of our updates is of data that has a variable number of columns.

    The initial update and binding works fine, but on subsequent updates that contain a different number of columns, the following error is returned:

         Data Write Error: The supplied data object does not match the size of the current selection.

    Note that subsequent updates with varying row counts work fine, so we know the bindings are intact.

    Is there was some way to "Reset" the table, allowing for a new set of rows and columns to be used? Or update the table with new, different columns and rows?

    Thank you!


    Paul

    Wednesday, July 1, 2015 10:07 PM

Answers

  • Thank you,

    This would be a perfect solution, however I am using pivoted data. Sometimes the column count is less, sometimes more, sometimes the same.

    I don't believe there is a TableBinding.removeColumnsAsync, so I had to come up with a workaround:

    I adjust the Table headers and rows object to contain dummy columns at the end so the count is always the same. In this manner, I am able to bind, TableBinding.deleteAllDataValuesAsync, TableBinding.addRowsAsync, and finally Binding.setDataAsync to replace the Column names (changing them from the dummy field names to the new ones).  I could not get it to work by calling Binding.setDataAsync alone without first deleteAllDataValuesAsync and addRowsAsync, which I found strange.

    Thank you for your reply, and a TableBinding.removeColumnsAsync would be a nice feature to have.


    Paul

    • Marked as answer by Paulem0071 Wednesday, July 8, 2015 8:58 PM
    Saturday, July 4, 2015 3:01 PM

All replies

  • Hi Paul,

    >>Is there was some way to "Reset" the table, allowing for a new set of rows and columns to be used? Or update the table with new, different columns and rows?<<

    To update the table has new columns and rows, we can use TableBinding.addColumnsAsync add the new columns first. Then we can add the news rows using TableBinding.addRowsAsync method.

    Regards & Fei 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, July 3, 2015 5:03 AM
  • Thank you,

    This would be a perfect solution, however I am using pivoted data. Sometimes the column count is less, sometimes more, sometimes the same.

    I don't believe there is a TableBinding.removeColumnsAsync, so I had to come up with a workaround:

    I adjust the Table headers and rows object to contain dummy columns at the end so the count is always the same. In this manner, I am able to bind, TableBinding.deleteAllDataValuesAsync, TableBinding.addRowsAsync, and finally Binding.setDataAsync to replace the Column names (changing them from the dummy field names to the new ones).  I could not get it to work by calling Binding.setDataAsync alone without first deleteAllDataValuesAsync and addRowsAsync, which I found strange.

    Thank you for your reply, and a TableBinding.removeColumnsAsync would be a nice feature to have.


    Paul

    • Marked as answer by Paulem0071 Wednesday, July 8, 2015 8:58 PM
    Saturday, July 4, 2015 3:01 PM
  • Hi Paul,

    Thanks for sharing the solution with us.

    If you want apps for Office to support the TableBinding.removeColumnsAsync in the further version, I suggest that you submit the feedback from link below:

    Customer Feedback for the Office Developer Platform

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 8, 2015 6:46 AM