Jump to content

Ivaylo Stanchev

Vectorworks, Inc Employee
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Ivaylo Stanchev

  1. Hi,

    Because of the two Excel file formats - XLSX and XLS, there are two different programing codes for each of the formats. To know which one to execute we need to know the extension or the whole name of the file. Assuming that anyway, the user will know the full name ( hardcoded or taken from file chooser) we decided to use EXL_NewBook(filePath) instead of EXL_NewBook(fileExtension).

     

    EXL_NewBook(filePath) returns TRUE because the initial XLS or XLSX code was successfully executed. But the real file is created only after calling EXL_SaveAndCloseBook(filePath).

     

    Technically, an empty string could be used in EXL_NewBook(''). In this case, the "XLSX" code will be executed by default. But if at the end, the book is saved and closed as "*.XLS", the file extension will differ from the file format. And an error will appear when opening this file using the Excel application.

     

    Here is a short script example. I hope you find it useful.

     

    PROCEDURE TestExcel;
    VAR
    	newname	: STRING;
    	res : BOOLEAN;
    	shNum : INTEGER;
    
    BEGIN
    	newname:= 'C:\\Temp\\Test.xlsx';
    	res := EXL_NEWBOOK('');
    	res := EXL_ADDSHEET('NEW_SHEET');
    	res := EXL_GETSHEETINDEX('NEW_SHEET',shNum);
    IF ( res = TRUE) THEN
    BEGIN
    	res := EXL_SETCELLSTRING(shNum,0,0,newname);
    END; 
    	res := EXL_SAVEANDCLOSEBOOK(newname);
    	
    END;
    Run(TestExcel);

     

    Best regards,

    Ivaylo.

  2. @SLFY Hi,

     

    Here is the list of supported functions. Means that they should be translated well form Excel to Vectorworks and vice versa.

    Named ranges are not supported yet. And the sheet referencing also is not supported for now. Therefore if you import cell "=SUM(MyRange)" it will be placed in the Vectorworks the same way. And thus "=SUM(MyRange)"  will show an #VALUE! error.

     

    Thanks,

    Ivaylo.

    изображение.png

    • Like 1
  3. Hi @WhoCanDo ,

     

    About the

    10 hours ago, WhoCanDo said:

    Response := StrDialog ('Search Data filename:', Concat (SearchDataPath, FName));

    ShowWS (GetObject ('Search Data'), True);
    DoMenuTextByName ('Export Worksheet', 0);
    ShowWS (GetObject ('Search Data'), False);

     

     

    I'm attaching a video. Can you please look at it and tell me what is wrong there? I don't argue. I'm just trying to understand.

    Also, what WSExport (WSName : string; Tab, All Rows, Recalc, Open : boolean) should do? Do you mean it should launch the export dialog, with name and settings according to the parameters, i.e. to substitute DoMenuTextByName ('Export Worksheet', 0)?

     

     

    Thank you,

    Ivaylo.

×
×
  • Create New...