Export to Excel (Network Floder)

static void ExcelSaveTest(Args _args)
{
int row;
SysExcelCells cells;
SysExcelApplication sysExcelApplication;
SysExcelWorkBooks sysExcelWorkBooks;
SysExcelWorkBook sysExcelWorkBook;
SysExcelWorkSheets sysExcelWorkSheets;
SysExcelWorkSheet sysExcelWorkSheet;
str value;
value = "shiva";

try
{
sysExcelApplication = SysExcelApplication::construct();
sysExcelWorkBooks = sysExcelApplication.workbooks();
sysExcelWorkBook = sysExcelWorkBooks.add();
sysExcelWorkSheets = sysExcelWorkbook.worksheets();
sysExcelWorkSheet = sysExcelWorkSheets.add();
sysExcelWorkSheet.name("Test to save File");

row=1;

if(row == 1)
{
sysExcelWorkSheet.cells().item(row,1).value(value);
sysExcelWorkSheet.cells().item(row,2).value(value);
sysExcelWorkSheet.cells().item(row,3).value(value);
sysExcelWorkSheet.cells().item(row,4).value(value);
}

sysExcelWorkSheet.columns().autoFit();
sysExcelApplication.visible(false);
}
catch
{
sysExcelApplication.quit();
}

//sysExcelWorkbook.saveAs("D:\\Test.xlsx");//working
sysExcelWorkbook.saveAs(@"\\"Target system Ip Address"\MicrosoftDynamicsAXAif60\Bin\test.xlsx");
sysExcelWorkBook.comObject().save();
sysExcelWorkBook.saved(true);
sysExcelApplication.quit();
info("Successfully file saved");
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s