我用MFC把已有的两个数组里面的数据读入到新建的EXCEL表格的两列,怎么操作啊?

2024-12-22 17:10:51
推荐回答(1个)
回答1:

void Uxxx::SetRangeText(long nItem,long nCol,CString strText)
{
CString strCell = Cell(nItem,nCol);
Range mRange = m_WorkSheet.GetRange( COleVariant( strCell ),COleVariant( strCell ) );
CellFormat mCellFormat;
mCellFormat.AttachDispatch(mRange.GetCells());
COleVariant varFormat("@");
mCellFormat.SetNumberFormatLocal(varFormat);
mRange.SetFormulaR1C1( COleVariant(strText) );
}