04-08-2008 01:22 AM
04-11-2008 11:42 AM
Hi vels02,
You can get a hold of the used cells by using the CNiExcelWorksheet.UsedRange() function. This function will return a block of the used cells in the format of A1:B9. Hence, it's possible to know the first row and last row used in a block of data.
I was also able to continuously append to an Excel worksheet simply by calling the CNiExcelWorksheet.GetRange() function with dynamic parameters. It seems that the Excel Automation does not give us the functionality to append to a file simply by using an "append" function. You must always have a specified range before sending the data to the Excel worksheet.
Also note that it's not necessary to send a matrix of data. You may use CNiExcelCellRange.SetCellValue() to send one value to a specific cell.
Attached is an example that demonstrates how to continuously append to a worksheet. I simply modified the example shipped with Measurement Studio. You are particularly interested in the function definition for CExcelReportDlg:: OnBnClickedButton3() under the ExelReportDlg.cpp file.
04-15-2008 08:20 PM