04.05.2010, 17:23 | #1 |
Участник
|
Вывод в Excel через Array
Доброго времени суток.
Задача: Создать отчет в Excel с табличной частью из шаблона Решение: Есть в отчете табличная область, например, A19:CG35 (N столбцов и M строк). Я заполняю массив Array N x M раз. X++: protected boolean fillData() { . . . ; reportRows = 0; . . . while select returnLine where returnLine.JournalId == returnTable.JournalId { inventTable = InventTable::find(returnLine.ItemId); custInvoiceJour = CustInvoiceJour::findFrominvoiceId(returnLine.InvoiceId); custInvoiceTrans = CustInvoiceTrans::findRecId(returnLine.CustInvoiceTransRecId); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", returnLine.ItemId)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", inventTable.ItemName)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", inventTable.ItemArticle)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", custInvoiceJour.InvoiceExternalId)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", custInvoiceJour.InvoiceDate)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", custInvoiceTrans.Qty)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", custInvoiceTrans.SalesPrice)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", custInvoiceTrans.amountDiscAmountInclTax())); tableRows.value(tableRows.lastIndex() + 1, ""); tableRows.value(tableRows.lastIndex() + 1, ""); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", returnLine.QtyDocument)); tableRows.value(tableRows.lastIndex() + 1, strfmt("%1", returnLine.SummDoc)); tableRows.value(tableRows.lastIndex() + 1, ""); tableRows.value(tableRows.lastIndex() + 1, ""); tableRows.value(tableRows.lastIndex() + 1, ""); reportRows++; } return (reportRows > 0) ? true : false; } return false; } X++: protected void fillTable() { Bookmark bookmark; ; bookmark = strfmt("%1%2:%3%4", #FirstTableCol, this.firstTableRow(), #LastTableCol, this.firstTableRow() + this.numOfRows() - 1); this.insertValue(bookmark, ExcelReportFromTemplate::array2variant(tableRows), 1); } Microsoft Business Solution Axapta 3.0 Build #1951.3730/514-193 SP3/OP023071 |
|
Теги |
ado, array, excel, recordset |
|
|