Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Save as dialog
Message
 
 
To
05/02/2019 22:13:53
General information
Forum:
ASP.NET
Category:
Javascript
Title:
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01665934
Message ID:
01665944
Views:
39
Hi Thomas,

We actually have one sample in our application that does save using SaveAs dialog, but in that sample the text file is already loaded into AceEditor on the form.

The code used in this case is the following:
 $scope.saveAceEditorFile = function (currentLayout, editorField) {
            if (editorField.length < 1) {
                return;
            }
            currentLayout.tmLayout = editorField;
           
            saveAs(
                    new Blob(
                        [currentLayout.tmLayout || ""]
                    , { type: "text/plain;charset=" + document.characterSet }
                )
                , (currentLayout.layoutname || "layout") + ".txt"
            );
        };
I found SaveAs file implementation and ng-CSV angular directive and some other FileApi implementations. Unfortunately, the code in these files is way over my head and so I'm not sure how to proceed from that sample I found.

Basically, my task is - click a button, execute SQL Server script to generate a huge tab delimited file and save it using SaveAs dialog. I am a bit lost as how exactly to proceed with this. I did find several threads about generating text file from SqlDataReader so I suppose I can use that (unless EF already has some method to generate a file directly), but what are my next steps?

Thanks.

>If users browser is set to always ask for DL destination, you can upload the string to server, create a temp file and DL that.
>While reading from local disk is considered less of a risk, I believe current HTML/browaser implementations forbid that due to security concerns.
>
>Or are you thinking of a non-Browser client like Node?
>
>>Hi everybody,
>>
>>I'm working on a User Story that has the following requirement: when I click on a button, the Save As dialog should popup and when the user selected a location, a file should be generated (tab delimited file) and saved in that location.
>>
>>I did a quick google search and I don't see as what I am supposed to implement. I'm using angularJS for front-end development and ASP.NET MVC for server side development.
>>
>>Thanks in advance.
>>
>>In other words, I have the following few VFP lines and I need to re-create that functionality from the browser:
>>
>>lcFile = PUTFILE("Name the RGIS Validation file to export to.","RGIS_Validation_" + ;
>>                    DTOC(DATE(), 1) + ".txt", "txt,dat")
>>   if ! empty(lcFile)
>>	   COPY TO (lcFile) DELIMITED WITH TAB
>>	   MESSAGEBOX('RGIS Validation file created.', 0, 'Tallyman Notification')
>>	 endif
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform