ggreen86 / XLSX-Workbook-Class

VFP Class to Create an XLSX Workbook without Excel Automation or Installed
45 stars 16 forks source link

Doesn't properly import file #80

Closed DougHennig closed 1 year ago

DougHennig commented 1 year ago

The attached file isn't imported properly. For example, loExcel.GetCellValue(1, 1, 2, 1) (row 2, cell 1) should return "67560A" but it returns "84161", which is the value in row 14, cell 1. Other values are similarly wrong.

The problem is caused by the first column containing values that are sometimes numeric and sometimes text. When I traced the code, I found that the rows with numeric values (e.g. row 4, value 99865) were processed first, then the rows with text values (e.g. row 2, value 67560A). As a result, the xl_strings cursor has duplicate ID values (e.g. there are two records with ID = 8) and GetCellValue finds the first one, which isn't the correct record. test.xlsx

ggreen86 commented 1 year ago

Thank you for submitting the workbook. I have confirmed the problem which was caused by cell values with numeric values being formatted as a text value. I was storing these cell values as a string value with a generated string Id value; however, these generated string id values were conflicting with the string id values from the sharedstring.xml file since the worksheet xml file was being processed it first. I have corrected the read processing to now store with the formatting id only. The class is now successfully processing the text.xlsx file that was submitted.