How to retrieve excel cell formatting properties in app-for-office add-in - apps-for-office

I'm starting to play around with apps for office - specifically working on a task-pane app for excel that needs to retrieve cell formatting properties from a range.
It is possible to set properties in a bound table with
bindingObj.setFormatsAsync(cellFormat [,options] , callback);
but an equivalent getFormatsAsync() doesn't appear to exist. Anybody know how to do this?

Related

Inserting OMML formulas into Excel sheet via office.js

Is it possible to add a mathematical formula (not an Excel equation) of OMML type into an Excel sheet via office.js? I know you can add them manually by using "Insert" / "Equation" ("Equation" just below "Symbol"), which results in an OMML formula (an <m:oMath> element in the Excel sheet XML source).
Thanks Stefan,
Unfortunately, Office JS Excel API currently doesn't support OMML type. Therefore, I would suggest that you could submit the request and upvote this request at uservoice. https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback?category_id=163563

WrapText- Auto format cell height

I am using OpenXML to create reports, I am filling data in existing excel template file.
In excel template 'Wrap text' for all cells is set to true. When my report is complete I open excel file.
In opened file cells are not sized correctly with text wrapping (text wrapping is not applied). Also I observed on machine with office 2007 it works cell are wrapped but on office 2013 cell are not correctly wrapped. If I just double click on any cell then entire row is correctly updated.
Can someone please help me in this, is any property \tag I can set in openXML so that on document open cells are correctly shown.
Previously we were using OLE office interface there it works always so expectation is it should work with openXML too.
Thanks,
Dhanaj

SSIS export to Excel template - keep row height

I have a following excel 2007 template (.xlsx):
I have set up an SSIS process to copy that template and populate the first two columns with data as the file will be printed and then signed by order recipients. Everything is going well except for one thing - after the process populates the template with data, the cells don't retain their size - making signature cells too small.
Any ideas on how to force excel to keep the cell heights ?
One idea would be to create a macro that runs when the workbook is opened and it sets the row height using the Range.RowHeight property, here:
https://msdn.microsoft.com/en-us/library/office/ff193926.aspx
If anyone ever has a similar issue, I managed to find a workaround. Instead of using SSIS I'm using SSRS where I keep the cell height by adding an "invisible (white text on white background) column at the end. I set up an SSRS subscription to automatically export the data and send as an Excel.

Identify selected chart in Excel Add-In

Is there a way to identify which chart has the user selected, parallel to the way to identify the selected range (workbook.getSelectedRange()) in Excel, in an Office Add-in?
Further, is there a way to identify which range the chart is based on?
I couldn't find anything that would let me do this in the Excel JS API Reference.
No to both. However, they are on our roadmap (no dates yet)
Both are in our plan and you should be able to see it soon this year.

Get values and formulas of a workbook by JavaScript API for Excel 2013?

I often need to collect the values and formulas of the usedRange of all the worksheets. I am wondering how to do this by JavaScript API for Excel 2013.
It seems that the only way to get/read data is via binding. There are for example MatrixBindings and TableBindings. But I don't see how to bind to a fixed area (let's say A1:Z1000 of Sheet1).
Could anyone help?
Here's a way to get the values in a named range in Excel 2013:
var myBindings = Office.context.document.bindings;
myBindings.addFromNamedItemAsync("Sheet1!A1:Z1000", "matrix", {}, function (asyncResult) {
asyncResult.value.getDataAsync(function (asyncResult2) {
console.log(asyncResult2.value);
});
});
There isn't any way to get the formulas in 2013.
I should note the smaller API set available for Excel 2013 isn't really designed for getting the entire contents of sheets, but the above code will still work for this narrow case.
-Michael Saunders (Program Manager for add-ins in Office)

Resources