
Dear All,
I am using OXML to read an excel file from server side.
When i enter the data manually in the excel file it is working fine. I can able to ready the excel file.
Link I used: axbytes.blogspot.fr/.../readwrite-excel-files-from-aos-using.html
But when i copy paste the data from some other place, i am not able to ready the excel file.
When i debugged, i found where it is getting blocked based on a validation
When i try to fetch the value in the cell ,
oxmlspreadSheet = OXMLSpreadsheetDocument_RU::construct(tmpMovTo);
oxmlworkBook = OXMLWorkBook_RU::construct(oxmlspreadSheet);
worksheets = oxmlworkBook.worksheets();
for (worksheetNumber = 1; worksheetNumber <= worksheets.elements(); worksheetNumber++)
{
oxmlworksheet = oxmlworkBook.getWorksheet(worksheetNumber);
sheetName = oxmlworksheet.name();
if (sheetName != #Instruction) // to skip the instruction sheet and read the second sheet
{
rows = oxmlworksheet.rows();
// rowNum 1 is header so skipped
for ( rowNum = 2; rowNum <= rows.elements(); rowNum++)
{
if (!oxmlworksheet.row(rowNum).cells().empty()) // row is empty or not
{
oxmlrow = oxmlworksheet.row(rowNum);
cells = oxmlrow.cells();
isRecord = false;
for ( colNum = 1; colNum <= cells.elements(); colNum++)
{
//if (!oxmlworksheet.row(rowNum).cell(colNum).cellReferenceByIndex(colNum))
if (!oxmlworksheet.row(rowNum).cell(colNum).getValue())
{
isRecord = true;
}
}
// To store the row values in a container
if(isRecord)
{
for (colNum = 1; colNum <= cells.elements(); colNum++)
{
oxmlcell = oxmlrow.cell(colNum);
sLine += oxmlcell.getValue();
}
}
In the above snippet, when i try to get value of the cell,
it is getting inside the class, OXMLCELL_RU > getValue() method, here if the type is string they are calling one more method getSharedStringValue() ..where error is thrown, saying already the value exist in the cell.
1. Is there any way to fetch value from the cell ?
2. Any examples, or links. I searched in AX using cros reference but nowhere it is used
3. Or is there any other way to read excel file in server side
Regards,
Arun B S
*This post is locked for comments
I have the same question (0)If the pasted data cannot be fetched, but the manually entered one can, then it must be formatting-related.
Maybe you have hidden rows? If you used an AX definition group with an Excel template, the first couple of rows are hidden and specially formatted, which may be the cause why it does not work.
Also check the formatting of the cell (general/text/custom) as that might be wrong.
Validate that in what region / locality have you created the data, maybe different regions are causing the problem.