I have code in clicked button
void clicked()
{
// super();
// static void ProductType(Args _args)
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
Name name;
FileName filename;
//ProductType productType;
// SHG_ListVendor shg_ListVendor;
int row;
str _SHG_VendAccount;
str _SHG_Name;
str _SHG_VendorGroup;
str _SHG_BuyerGroupId;
str _SHG_TaxNumber;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
filename = "C:\item.xls";
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(4); //Here 3 is the worksheet Number
cells = worksheet.cells();
do
{
row++;
// _productTypeId = any2int(cells.item(row, 1).value().toString());
_SHG_VendAccount = cells.item(row, 1).value().bStr();
_SHG_Name = cells.item(row, 2).value().bStr();
_SHG_VendorGroup = cells.item(row, 3).value().bStr();
_SHG_BuyerGroupId = cells.item(row, 4).value().bStr();
_SHG_TaxNumber = cells.item(row,5).value().bStr();
SHG_ListVendor.SHG_VendAccount = _SHG_VendAccount;
SHG_ListVendor.SHG_Name = _SHG_Name;
SHG_ListVendor.SHG_VendorGroup = _SHG_VendorGroup;
SHG_ListVendor.SHG_BuyerGroupId = _SHG_BuyerGroupId;
SHG_ListVendor.SHG_TaxNumber = _SHG_TaxNumber;
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
But I got a problem when I want to click the button for open the file
![]()