using System.IO;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using OfficeOpenXml.Table;
class SRWriteToExcel
{
public static void main(Args _args)
{
CustTable custTable;
MemoryStream memoryStream = new MemoryStream();
using (var package = new ExcelPackage(memoryStream))
{
var currentRow = 1;
var worksheets = package.get_Workbook().get_Worksheets();
var CustTableWorksheet = worksheets.Add("Export");
var cells = CustTableWorksheet.get_Cells();
OfficeOpenXml.ExcelRange cell = cells.get_Item(currentRow, 1);
System.String value = "Account Number";
cell.set_Value(value);
cell = null;
value = "Currency";
cell = cells.get_Item(currentRow, 2);
cell.set_Value(value);
while select CustTable
{
currentRow ++;
cell = null;
cell = cells.get_Item(currentRow, 1);
cell.set_Value(CustTable.AccountNum);
cell = null;
cell = cells.get_Item(currentRow, 2);
cell.set_Value(CustTable.Currency);
cell = cells.get_Item(currentRow, 3);
cell.set_Value(CustTable.CustGroup);
cell = cells.get_Item(currentRow, 4);
cell.set_Value(CustTable.TaxItemGroup);
cell = cells.get_Item(currentRow, 5);
cell.set_Value(CustTable.Name());
}
package.Save();
file::SendFileToUser(memoryStream, ‘Test’);
}
}
}
Comments