6. März 2020 12:46
ExcelBuffer.DELETEALL;
ExcelFile := FileMgt.OpenFileDialog(Text01,'',ExcelFileExtensionFilter);
IF ExcelFile = '' THEN
EXIT;
ServerFileName := FileMgt.UploadFileSilent(ExcelFile);
IF ServerFileName = '' THEN
EXIT;
ExcelSheet := ExcelBuffer.SelectSheetsName(ServerFileName);
IF ExcelSheet = '' THEN
EXIT;
ExcelBuffer.LOCKTABLE;
ExcelBuffer.OpenBook(ServerFileName, ExcelSheet);
ExcelBuffer.ReadSheet;
IF ExcelBuffer.FINDFIRST THEN BEGIN
CountRows := ExcelBuffer."Row No.";
CountColumns := ExcelBuffer."Column No.";
END;
FOR I := 2 TO CountRows DO BEGIN
ExtLine.INIT;
"Extended Text Header".INIT;
IF ExcelBuffer.GET(I,1) THEN BEGIN
NewEAN := ExcelBuffer."Cell Value as Text";
Item.SETRANGE("EAN Code", NewEAN);
Item.FINDFIRST;
ExtLine."No." := Item."No.";
"Extended Text Header"."No." := Item."No.";
ExtLine."Table Name" := ExtLine."Table Name"::Item;
"Extended Text Header"."Table Name" := "Extended Text Header"."Table Name"::Item;
ExtLine."Language Code" := '';
"Extended Text Header"."Language Code" := '';
ExtLine."Text No." := 1;
"Extended Text Header"."Text No." := 1;
ExtLine."Line No." := 10000;
ExtLine.Shop := TRUE;
"Extended Text Header".Shop := TRUE;
ExtLine.INSERT;
"Extended Text Header".INSERT;
END;
FOR C := 2 TO CountColumns DO BEGIN
IF ExcelBuffer.GET(I,C) THEN BEGIN
ExtLine.Text := ExcelBuffer."Cell Value as Text";
ExtLine.MODIFY;
"Extended Text Header".MODIFY;
ExtLine."Line No." += 10000;
ExtLine."Text No." += 1;
END;
END;
END;
6. März 2020 13:36
6. März 2020 13:48
9. März 2020 10:41
ExcelBuffer.DELETEALL;
ExcelFile := FileMgt.OpenFileDialog(Text01,'',ExcelFileExtensionFilter);
IF ExcelFile = '' THEN
EXIT;
ServerFileName := FileMgt.UploadFileSilent(ExcelFile);
IF ServerFileName = '' THEN
EXIT;
ExcelSheet := ExcelBuffer.SelectSheetsName(ServerFileName);
IF ExcelSheet = '' THEN
EXIT;
ExcelBuffer.LOCKTABLE;
ExcelBuffer.OpenBook(ServerFileName, ExcelSheet);
ExcelBuffer.ReadSheet;
IF ExcelBuffer.FINDFIRST THEN REPEAT
CountRows := ExcelBuffer."Row No.";
IF ExcelBuffer."Column No." > CountColumns THEN
CountColumns := ExcelBuffer."Column No.";
UNTIL ExcelBuffer.NEXT = 0;
FOR I := 2 TO CountRows DO BEGIN
"Extended Text Header".INIT;
IF ExcelBuffer.GET(I,1) THEN BEGIN
NewEAN := ExcelBuffer."Cell Value as Text";
Item.SETRANGE("EAN Code", NewEAN);
Item.FINDFIRST;
"Extended Text Header"."No." := Item."No.";
"Extended Text Header"."Table Name" := "Extended Text Header"."Table Name"::Item;
"Extended Text Header"."Language Code" := '';
"Extended Text Header"."Text No." := 1;
"Extended Text Header".Shop := TRUE;
"Extended Text Header".INSERT;
ExtLine."Line No." := 0;
END;
FOR C := 2 TO CountColumns DO BEGIN
IF ExcelBuffer.GET(I,C) THEN BEGIN
ExtLine."No." := Item."No.";
ExtLine."Table Name" := ExtLine."Table Name"::Item;
ExtLine."Language Code" := '';
ExtLine."Text No." := 1;
ExtLine.Shop := TRUE;
ExtLine.Text := ExcelBuffer."Cell Value as Text";
ExtLine."Line No." += 10000;
ExtLine.INSERT;
END;
END;
END;