Announcements
No record found.
Hi Guys,
I want to add some label to (for example 'en-us') . now some label are in a file excel as below.
What is x++ code exactly to do this?
*This post is locked for comments
Hi Hossein,
First you need to read excel file through X++ code, please refer: community.dynamics.com/.../how-to-read-write-an-excel-file-through-x-code
You can use the SysLabelEdit.labelInsert to create new lables, please refer: community.dynamics.com/.../insert-label-by-code-in-axapta-in-any-language
Thanks Ada Ding,
It work correctly.
static void ImportExcel(Args _args) { SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelCells cells; FileName filename; LabelId labelId; str st1, st2; int row = 0 ; SysLabelEdit SysLabelEdit = new SysLabelEdit(); application = SysExcelApplication::construct(); workbooks = application.workbooks(); //specify the file path that you want to read filename = "D:\\importtest.xlsx"; try workbooks.open(filename); catch (Exception::Error) throw error("File cannot be opened."); workbook = workbooks.item(1); worksheets = workbook.worksheets(); worksheet = worksheets.itemFromNum(1); cells = worksheet.cells(); do { row++; labelId = "@" + cells.item(row, 1).value().bStr(); SysLabelEdit.labelModify('en-us', labelId, cells.item(row,2).value().bStr(), cells.item(row, 3).value().bStr(), SysLabelApplModule::None); } while (row != 4); application.quit(); }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CP04-islander 39
Michel ROY 14
imran ul haq 8