none
How to delete all the row data along with headers in Office app 2013 RRS feed

  • Question

  • Hi, 

    I have created an office app 2013 using Office add-ins following this link 

    https://msdn.microsoft.com/en-us/library/office/dn848361.aspx

    Problem i am facing is,  available method for deleting row data only deletes the data but it doesn't delete HEADERS.

    I am using this method :

    function deleteAllRowsFromTable() {
            Office.context.document.bindings.getByIdAsync("GF-HeaderBinding", function (asyncResult) {
                var binding = asyncResult.value;
                binding.deleteAllDataValuesAsync();
            });
        }
    Can it be possible to delete all the data available in the excel.


    • Edited by Spark27 Wednesday, November 18, 2015 11:18 AM Font size changes
    Wednesday, November 18, 2015 11:17 AM

Answers

  • Hi Rajd27,

    >> How to delete all the row data along with headers in Office app 2013

    No, it is impossible. I check the API of Office add-ins, and there is no such API to delete table header.

    For a workaround, I suggest you use “matrix” instead of “table”. Here is a simple code:

    // Function that writes to a div with id='message' on the page.
    function write(message) {
        document.getElementById('message').innerText += message;
    }
    
    function writeMatrix() {
        Office.context.document.setSelectedDataAsync([["Red", "Rojo"], ["Green", "Verde"], ["Blue", "Azul"]], {coercionType: "matrix"},
        function(asyncResult) {
            var error = asyncResult.error;
            if (asyncResult.status === "failed"){
                write(error.name + ": " + error.message);
            }
        });
    
    
    }
    
    function EmptyMatrix() {
        Office.context.document.setSelectedDataAsync([["", ""], ["", ""], ["", ""]], { coercionType: "matrix" },
        function (asyncResult) {
            var error = asyncResult.error;
            if (asyncResult.status === "failed") {
                write(error.name + ": " + error.message);
            }
        });
    }
    

    Best Regards,

    Edward


    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.


    Thursday, November 19, 2015 10:01 AM