none
Matrix Table Formatting RRS feed

  • Question

  • Office.context.document.setSelectedDataAsync(accountTableMatrix, 
    {
    coercionType: "matrix",
    cellFormat: [{ cells: { column: 1}, format: { fontColor:"red" }}]
    }, 
    function (result) {}});
    I've been trying a lot of different things to get matrix formatting to work in Excel but I haven't been able to yet. I also tried using setFormatsAsync() and setDataAsync() with no success. I even tried copying sample code from msdn into the Napa cloud app and couldn't get it to work there in any way either. Everything in the documentation says it's possible to set the format for matrix data but some people online have suggested that's not true. 

    Friday, August 7, 2015 2:26 PM

Answers

  • Hi billy.laurain,

    Based on my understanding, the cellformat option work only for tables (not for Office.CoercionType.Text or Office.CoercionType.Matrix data structures). In addition, to make it work, we need to use 1.1 app manifest schema.

    You can get more detail about data formating and updating Office add-ins from link below:
    Format tables in add-ins for Excel

    Update the version of your JavaScript API for Office and manifest schema files

    In addition, here is sample for your reference:

     var myTable = new Office.TableData();
            myTable.headers = [["Cities"]];
            myTable.rows = [['Berlin'], ['Roma'], ['Tokyo'], ['Seattle']];
    
            Office.context.document.setSelectedDataAsync(myTable, {
                coercionType: "table",
                cellFormat: [{ cells: { column: 0 }, format: { fontColor: "red" } }]
    
            }, function (result) {
                      })

    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.

    Monday, August 10, 2015 4:46 AM
    Moderator

All replies

  • Hi billy.laurain,

    Based on my understanding, the cellformat option work only for tables (not for Office.CoercionType.Text or Office.CoercionType.Matrix data structures). In addition, to make it work, we need to use 1.1 app manifest schema.

    You can get more detail about data formating and updating Office add-ins from link below:
    Format tables in add-ins for Excel

    Update the version of your JavaScript API for Office and manifest schema files

    In addition, here is sample for your reference:

     var myTable = new Office.TableData();
            myTable.headers = [["Cities"]];
            myTable.rows = [['Berlin'], ['Roma'], ['Tokyo'], ['Seattle']];
    
            Office.context.document.setSelectedDataAsync(myTable, {
                coercionType: "table",
                cellFormat: [{ cells: { column: 0 }, format: { fontColor: "red" } }]
    
            }, function (result) {
                      })

    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.

    Monday, August 10, 2015 4:46 AM
    Moderator
  • So why does every page of documentation relating to matrix data or formatting say that this is possible? Is Microsoft planning to update their product anytime soon to add some of the features they've already been telling us to use?
    Monday, August 10, 2015 1:52 PM
  • Hi billy.laurain,

    Would you minding sharing with us the link that you metioned? Also if you have any feedback about the document, you can submit them from the bottom page like figure below:

    And if you want the fromating APIs to support the matrix in the further version, you can also 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.

    Tuesday, August 11, 2015 6:37 AM
    Moderator