using System.IO; using OfficeOpenXml; using OfficeOpenXml.Style; using OfficeOpenXml.Table; ////// Vendor Wise Outstanding /// class VendorWiseOutstandingCSV extends CSVExport { BalanceAsOnDate ToDate; DialogField dfToDate; FormBuildStringControl fbscMultiVendCode; FormStringControl fscMultiVendCode; container vendCodeCon; Str1260 vendCode; SysLookupMultiSelectCtrl multiVendCodeCtrl; VendTrans vendtrans; AmountCur remainAmountCur; real NotDueBalance,PrePaybalance,AdvToVend; OfficeOpenXml.ExcelRange cell; OfficeOpenXml.ExcelRange cells; int currentRow = 1; ////// buildQuery /// /// query query buildQuery() { QueryBuildDataSource qbdsVendTable, qbdsInventSite;/ Query query = new Query(queryStr(VendorWiseOutstanding)); qbdsVendTable = query.dataSourceTable(tableNum(VendTable)); qbdsInventSite = query.dataSourceTable(tableNum(InventSite)); vendCode = con2Str(vendCodeCon); if(vendCode) { vendCode = strReplace(vendCode,';',','); qbdsVendTable.addRange(fieldNum(VendTable, AccountNum)).value(vendCode); } return query; } ////// export /// /// boolean boolean export() { #Properties MemoryStream memoryStream = new MemoryStream(); QueryRun qr; VendTable vendTable; using (var package = new ExcelPackage(memoryStream)) { var worksheets = package.get_Workbook().get_Worksheets(); var CustTableWorksheet = worksheets.Add('Vendor Wise Outstanding'); cells = CustTableWorksheet.get_Cells(); // Report header start currentRow ; cell = null; cell = cells.get_Item(currentRow, 1); cell.set_Value('Vendor Code'); cell = null; cell = cells.get_Item(currentRow, 2); cell.set_Value('Vendor Name'); cell = null; cell = cells.get_Item(currentRow, 3); cell.set_Value('Vendor Group'); cell = null; cell = cells.get_Item(currentRow, 4); cell.set_Value('MSME Yes/No'); cell = null; cell = cells.get_Item(currentRow, 5); cell.set_Value('Vendor Hold Status '); qr = new queryRun(this.buildQuery()); while (qr.next()) { vendTable = qr.get(tableNum(VendTable)); currentRow ; cell = null; cell = cells.get_Item(currentRow, 1); cell.set_Value(vendTable.AccountNum); cell = null; cell = cells.get_Item(currentRow, 2); cell.set_Value(vendTable.displayVendName(vendTable)); cell = null; cell = cells.get_Item(currentRow, 3); cell.set_Value(vendTable.VendGroup); cell = null; cell = cells.get_Item(currentRow, 4); cell.set_Value(vendTable.MSMEVendor); cell = null; cell = cells.get_Item(currentRow, 5); cell.set_Value(enum2Str(vendTable.Blocked)); } package.Save(); file::SendFileToUser(memoryStream, filename '.xlsx'); } return true; } }
I have created this excel report , now as I run this report fron it dialog from frontend , it downloads like this ,
but requirement is It should be saved to sharepoint directly instead of downloading
Hi, I think it's because SendFileToUser, you can check this article
André Arnaud de Cal...
291,996
Super User 2025 Season 1
Martin Dráb
230,853
Most Valuable Professional
nmaenpaa
101,156