Hi Dmitry,
You could use COM Automation interfaces to push your data into Excel - then it will work exactly like the VBA.
With the C API (which Excel-DNA uses) there is no direct interpretation of DateTimes - these just get set as the corresponding double.
The C API call to set the formatting would look like this:
// Select a cell on the active sheet
XlCall.Excel(XlCall.xlcFormulaGoto, refToSelect);
// Set the selected cell's format
XlCall.Excel(XlCall.xlcFormatNumber, desiredFormat)
It's a bit inconvenient, and if the reference is not on the active sheet, you first have to activate the corresponding sheet. There's a helper class called ExcelSelectionHelper in the sample Distribution\Samples\Async\AsyncMacros.dna which allow you to say:
// Set the formatting of the function caller
using (new ExcelSelectionHelper(myReference)
{
XlCall.Excel(XlCall.xlcFormatNumber, desiredFormat);
}
this also restores the selection after the call.
But for most cases, for a macro that writes out a report to Excel based on a ribbon click or something, I'd suggest using the COM Automation interfaces.
The everything is pretty much the same as in VBA. (Just remember to get the root Application object via ExcelDnaUtil.Application.)
Regards,
Govert