Found examples on microsoft firm site
http://code.msdn.microsoft.com/office/CppAutomateExcel-44214081
solution 2
An example is given of how to enable Excel, create a worksheet, write a couple of names and save everything to the xlsx file.
All this in the following form:
VARIANT saNames; saNames.vt = VT_ARRAY | VT_VARIANT; { SAFEARRAYBOUND sab[2]; sab[0].lLbound = 1; sab[0].cElements = 5; sab[1].lLbound = 1; sab[1].cElements = 2; saNames.parray = SafeArrayCreate(VT_VARIANT, 2, sab); SafeArrayPutName(saNames.parray, 1, L"John", L"Smith"); SafeArrayPutName(saNames.parray, 2, L"Tom", L"Brown"); SafeArrayPutName(saNames.parray, 3, L"Sue", L"Thomas"); SafeArrayPutName(saNames.parray, 4, L"Jane", L"Jones"); SafeArrayPutName(saNames.parray, 5, L"Adam", L"Johnson"); } // Fill A2:B6 with the array of values (First and Last Names). // Get Range object for the Range A2:B6 IDispatch *pXlRange = NULL; { VARIANT param; param.vt = VT_BSTR; param.bstrVal = SysAllocString(L"A2:B6"); VARIANT result; VariantInit(&result); AutoWrap(DISPATCH_PROPERTYGET, &result, pXlSheet, L"Range", 1, param); pXlRange = result.pdispVal; VariantClear(¶m); } { IDispatch *pXlCells, *pXlEntireColumn; VARIANT result; VariantInit(&result); AutoWrap(DISPATCH_PROPERTYGET,&result, pXlSheet,L"Cells", 0); pXlCells=result.pdispVal; VariantInit(&result); AutoWrap(DISPATCH_PROPERTYGET,&result, pXlCells,L"EntireColumn", 0); pXlEntireColumn=result.pdispVal; AutoWrap(DISPATCH_METHOD, NULL,pXlEntireColumn,L"ColumnWidth", 1, 50); } The functions in the example are not enough for me. You also need at least a change in the width of the nth column, setting the text color and centering the text in the cell.
When browsing the internet, no detailed documentation was found on these features. Where to find it or ask? What arguments should be passed to the AutoWrap () method to set the width of the column