Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BESTFIT error while loading file #118

Open
SeregaKR opened this issue May 19, 2024 · 0 comments
Open

BESTFIT error while loading file #118

SeregaKR opened this issue May 19, 2024 · 0 comments

Comments

@SeregaKR
Copy link

SeregaKR commented May 19, 2024

Good evening.
Today, I again have to fill an Excel file with numbers from DBF. The code works somewhat in R38 but raises an error in R42.

The problem in R38 is again the codepage. Even when explicitly set to 1251, it changes the text inside the cells that I didn't change with the code explicitly.

I switched to R42, as there were some improvements there. Now, the file doesn't even open properly. I get Error 8 about BestFit (Field BESTFIT does not accept null values) while opening the file. I didn't even start working with it. I attached the file and the XML specifically. I tried resaving the original workbook with Excel or LibreOffice, but with the same result.

The sample code is below. Here, I just add one value.

lcFile = "Шаблон_ЗПЗ.xlsx"

SET CLASSLIB TO "vfpxworkbookxlsx" ADDITIVE 
loExcel = CREATEOBJECT("vfpxworkbookxlsx")

loExcel.DefaultFont = "Times New Roman"
loExcel.DefaultFontSize = 12
loExcel.Codepage = 1251

lnWb = loExcel.openxlsxworkbook(lcFile)

col_start = ASC("D") - ASC("A") +1
test1 = 8

cur_cell_value = ALLTRIM(LOWER(CAST(loExcel.GetCellValue(lnWb, 2, 8, col_start+0) as C)))	
IF cur_cell_value != "x" THEN 
	loExcel.SetCellValue(lnWb, 2, 8, col_start+0, test1)
ENDIF

loExcel.SaveWorkbookAs(lnWb, TempBaseDir + "test.xlsx")
RELEASE loExcel, lnWb

Шаблон_ЗПЗ.xlsx
sheet1.xml

It seems that there is a similar issue #90, but I can't be sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant