WhoCanDo Posted October 5, 2020 Share Posted October 5, 2020 Hi, We have skipped from VW2019 to VW2021 so I don't know what happened in between, however can someone help with the following please. We have a number of worksheets that need to be exported to a tab delimited .txt file. VW2019 allows us to do this with DoMenuTextByName ('Export Worksheet', 0); VW2019 does not have the option to automatically open them in the default view so it's quick and easy. However, VW2021 has a tick box that defaults to "Open file in default viewer". We don't want to view the file after export. It is only for data collection. How can we DoMenuTextByName ('Export Worksheet', 0); without the file opening? The .TAB file type is remembered in the stationary sheet, or last used, but the tick box continues to default to SELLECTED. Also there doesn't seem to be an WSExport (WSName : string; Tab, All Rows, Recalc, Open : boolean), procedure or function yet, which would be idea with the improvement of the export options. Regards Quote Link to comment
MullinRJ Posted October 5, 2020 Share Posted October 5, 2020 @WhoCanDo , I don't know what changed with the DMTBN() command. However, there are 32 new VS commands in VW 2021 that interface with Excel files. I have not used them so I cannot comment on them beyond their existence. Perhaps you can loop through your Worksheet's cells and export each cell to an Excel file. It seems more tedious than simply exporting to a text file, but it may give you more control. If you're lucky, @Pat Stanford has dabbled with these and can shed some light. These are the commands listed in the Script reference. Documentation is what you'd expect – thin. Excel_Convert EXL_AddSheet EXL_CloseBook EXL_DeleteSheet EXL_GetCellAlignment EXL_GetCellBordeDiff EXL_GetCellBorderB EXL_GetCellBorderL EXL_GetCellBorderR EXL_GetCellBorderT EXL_GetCellFill EXL_GetCellFont EXL_GetCellStyle EXL_GetCellValue EXL_GetSheetCnt EXL_GetSheetIndex EXL_GetSheetName EXL_GetSheetSize EXL_IsCellValid EXL_NewBook EXL_ReadFile EXL_SaveAndCloseBook EXL_SetCellAlignment EXL_SetCellBorderB EXL_SetCellBorderL EXL_SetCellBorderR EXL_SetCellBorderT EXL_SetCellFont EXL_SetCellNumber EXL_SetCellNumFormula EXL_SetCellStrFormula EXL_SetCellString Good luck, Raymond Quote Link to comment
Pat Stanford Posted October 5, 2020 Share Posted October 5, 2020 I don't know of a way around this, but I consider this a bug. If the rest of the parameters are being retained, then the users choice should be remembered for Open in Default Viewer also. Maybe for SP3 (SP2 if we are REALLY lucky, SP99 if we are unlucky.) As Raymond suggested, you could probably write a script that would generate a text file from the contents of your worksheet as an alternative. If you did that you could eliminate the dialog box all together and just hard code the file to write the data to. Quote Link to comment
Vectorworks, Inc Employee Nina Ivanova Posted October 6, 2020 Vectorworks, Inc Employee Share Posted October 6, 2020 13 hours ago, Pat Stanford said: SP2 if we are REALLY lucky You are lucky 🙂 This was already fixed for SP2. Quote Link to comment
WhoCanDo Posted October 6, 2020 Author Share Posted October 6, 2020 How did we get from the just released SP0 to SP2 so quickly? I'm ready 😃 Quote Link to comment
Pat Stanford Posted October 6, 2020 Share Posted October 6, 2020 Nina and I are living out 15 minutes in the future. If you today can handle the caffeine necessary your might be allowed to join us also! 1 Quote Link to comment
WhoCanDo Posted November 19, 2020 Author Share Posted November 19, 2020 After using VW2021 for a while, I suddenly noticed that the export menu is not exporting the data I am asking for. In VW2020 this worked but VW2021 has an additional feature to overcome. Response := StrDialog ('Search Data filename:', Concat (SearchDataPath, FName)); ShowWS (GetObject ('Search Data'), True); DoMenuTextByName ('Export Worksheet', 0); ShowWS (GetObject ('Search Data'), False); The above code works for VW2020 and all we do is save the file in a folder with a file name "Response". This is repeated for various worksheets. Now we have the following which will not only remember the ticks (fix happening in SP2 hopefully) but also has the worksheet drop list and always defaults to "Banding Cutting List". Can anyone suggest any further solutions or is it just a matter of hounding VW to create the procedure WSExport (WSName : string; Tab, All Rows, Recalc, Open : boolean) or similar ? Regards Quote Link to comment
Vectorworks, Inc Employee Nina Ivanova Posted November 19, 2020 Vectorworks, Inc Employee Share Posted November 19, 2020 @Ivaylo Stanchev, Would you, please, look at the previous post and work with the customer? Thanks! Quote Link to comment
Vectorworks, Inc Employee Ivaylo Stanchev Posted November 19, 2020 Vectorworks, Inc Employee Share Posted November 19, 2020 @WhoCanDo On 10/5/2020 at 10:28 AM, WhoCanDo said: However, VW2021 has a tick box that defaults to "Open file in default viewer". If you are using SP2 this should work for you. I just tested with a SP1 and a SP2 builds. If you are using SP2 and this still does not work, please let me know. Thank you, Ivaylo. Quote Link to comment
WhoCanDo Posted November 19, 2020 Author Share Posted November 19, 2020 Thanks Nina, Thanks Ivaylo, I'll let you know when the update is available in Australia to test. 1 Quote Link to comment
Vectorworks, Inc Employee Ivaylo Stanchev Posted November 19, 2020 Vectorworks, Inc Employee Share Posted November 19, 2020 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. Screen Recording (19.11.2020 г. 16-01-58)_x264.mov Quote Link to comment
WhoCanDo Posted November 19, 2020 Author Share Posted November 19, 2020 (edited) Looks good Ivaylo, I can see that when your 'Export Worksheet' appears, it has the name of the active/open worksheet, and I can't wait to try it. This WS name change for export is not happening in SP1 - maybe another bug fixed in SP2. I'll be happy that the problem is resolved if VW remembers the settings as default after closing and re-starting. Otherwise, VW has a whole heap of WS procedure like ShowWSDialog, etc. and many more new ones to expand upon functionality, if there are many people exporting, and that's the reason for the latest additions to the menu, then why not make a procedure like .... WSExport (Worksheet name, Format : string, Range All, Recalc, Open Viewer : boolean); to replace the show WS, export WS and close WS. Edited November 20, 2020 by WhoCanDo Lost a 'd' Quote Link to comment
Vectorworks, Inc Employee Ivaylo Stanchev Posted November 20, 2020 Vectorworks, Inc Employee Share Posted November 20, 2020 @WhoCanDo , It's not a bad idea. I'll think about it. But what about the name of the exported excel file? Quote Link to comment
WhoCanDo Posted November 20, 2020 Author Share Posted November 20, 2020 @Ivaylo Stanchev That's the reason for the Response := StrDialog ('Search Data filename:', Concat (SearchDataPath, FName)); After this DoMenuTextByName ('Export Worksheet', 0); the windows file save menu popped up. Knowing what the file name and path would be, I put is into the StrDialog so the user could copy and paste it into the windows file save. eg. concat ('c:\user\xxx\documents\worksheets\', GetFName); If FName could be another string parameter then that would be great. 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.