Git Product home page Git Product logo

Comments (25)

bingenortuzar avatar bingenortuzar commented on July 26, 2024 1

as workaround, On :

  function doClick() {
          if(window.navigator.msSaveOrOpenBlob) {
              var blob = new Blob([scope.csv], {
            (...)

I modify the blob creation to decode the CSV again :
var blob = new Blob([decodeURIComponent(scope.csv)]

from ng-csv.

asafdav avatar asafdav commented on July 26, 2024

Hi there,
Sorry for the late response, I just returned from a vacation.
Apparently IE doesn't support the "download" attribute yet,
I'll try to find a nice Polyfill or a workaround.

from ng-csv.

akatreyt avatar akatreyt commented on July 26, 2024

same for safari ...

from ng-csv.

asafdav avatar asafdav commented on July 26, 2024

thanks to @marcgara IE10+ are supported now,
as for safari, currently I could not find a good solution that will keep this library small

from ng-csv.

padsbanger avatar padsbanger commented on July 26, 2024

Any chance to make it work on IE9 ?

from ng-csv.

cr0man avatar cr0man commented on July 26, 2024

I've just give it a try on IE10, the generated CSV file is wrong. Instead of a multi-line CSV file, there is single continuous line.

from ng-csv.

asafdav avatar asafdav commented on July 26, 2024

What version did you use ?
I released a new version few days ago that should fix it

from ng-csv.

cr0man avatar cr0man commented on July 26, 2024

0.2.3 and 0.2.2.
Also I did not understand why is the encoding necessary. The content is already in the browser what is the purpose of encodeURIComponent()?
On Firefox the file is OK, but on IE10, space characters are encoded as %20.

from ng-csv.

asafdav avatar asafdav commented on July 26, 2024

Probably IE is not complient with the data uri standard,
I'm not sure what you mean by "already in the browser", but you have to encode your data in order to use data uri correctly, please go over this, it should clear it out for you.

Anyway, I'll go over the IE behavior.

from ng-csv.

Aldorus avatar Aldorus commented on July 26, 2024

@bingenortuzar Work perfectly, thank

from ng-csv.

asafdav avatar asafdav commented on July 26, 2024

Do you want to pull request your patch ?

from ng-csv.

bingenortuzar avatar bingenortuzar commented on July 26, 2024

Done (or at least I think so :) )

from ng-csv.

barbecube avatar barbecube commented on July 26, 2024

Hi,
update helped exporting valid CSV in IE but still encoding is not working as in other browser. I'm using add-bom so it opens correctly in Excel and it's not working in IE. Probably BOM is broken when exporting from IE.

from ng-csv.

asafdav avatar asafdav commented on July 26, 2024

I haven't released a new version yet. have you tried using the latest source code ?

from ng-csv.

barbecube avatar barbecube commented on July 26, 2024

Yes I added "var blob = new Blob([decodeURIComponent(scope.csv)],{" change from last pull request. It made it produce valid CSV in IE but looks like BOM is missing although I'm using add-bom.

from ng-csv.

iammanusharma avatar iammanusharma commented on July 26, 2024

Thank you very much for this directive .I used the latest updated version.
Its working well with ie9+. For ie9, file does not download .Any fix for ie9?

from ng-csv.

bingenortuzar avatar bingenortuzar commented on July 26, 2024

@barbecube I don't need BOOM, and no time now to try, but looking into code, saw:

if(window.navigator.msSaveOrOpenBlob) {
csv = csvContent;
}else{
csv = DATA_URI_PREFIX;
if (options.addByteOrderMarker){
csv += BOM;
}
csv += csvContent;
}
def.resolve(csv);
});

as you can see, the BOOM is not included for Blob downloads.
perhaps changing to this could work (NOT PROBED, just saying):

if(!window.navigator.msSaveOrOpenBlob) {
csv = DATA_URI_PREFIX;
}
else
{
csv = ''
}
if (options.addByteOrderMarker){
csv += BOM;
}
csv += csvContent;
def.resolve(csv);
});

from ng-csv.

inska avatar inska commented on July 26, 2024

Working with fix like as below? ng-csv not working in my IE.

var blob = new Blob([decodeURIComponent(scope.csv)],{
        if(!window.navigator.msSaveOrOpenBlob) {
          csv = DATA_URI_PREFIX;
        }else{
          csv = ''
        }
        if (options.addByteOrderMarker){
          csv += BOM;
        }
        csv += csvContent;
        def.resolve(csv);

from ng-csv.

bingenortuzar avatar bingenortuzar commented on July 26, 2024

nop!
the idea (and is just that, an idea) is to replace the "if(window.navigator.msSaveOrOpenBlob) {..." that starts on line 119 of ng-csv.js

from ng-csv.

asafdav avatar asafdav commented on July 26, 2024

Sorry for my late response, easy to miss comments in a closed pull request.
I just released a new version that should fix the BOM issues with IE.

from ng-csv.

BerangereMartin avatar BerangereMartin commented on July 26, 2024

for download attribut: http://caniuse.com/#search=download%20attribute

if somebody is interrested by using ng-csv supported by all bowser (also ie<10)

link: function (scope, element, attrs) {
                    function doClick() {
                        if (window.navigator.msSaveOrOpenBlob) {
                            var blob = new Blob([decodeURIComponent(scope.csv)], {
                                type: "text/csv;charset=utf-8;"
                            });
                            navigator.msSaveBlob(blob, scope.getFilename());
                        } else {
                            if (window.navigator.appName === 'Microsoft Internet Explorer') {
                                var iframe = angular.element('<iframe></iframe>');
                                iframe[0].style.display = "none";
                                element.append(iframe);
                                var doc = null;
                                if (iframe[0].contentDocument) 
                                    doc = iframe[0].contentDocument;
                                else if (iframe[0].contentWindow) 
                                    doc = iframe[0].contentWindow.document;
                                doc.open("text/plain", "replace");
                                doc.write([decodeURIComponent(scope.csv)]);
                                doc.close();
                                //iframe.focus();
                                doc.execCommand('SaveAs', true, scope.getFilename());
                            } else {
                                var downloadLink = angular.element('<a></a>');
                                downloadLink.attr('href', scope.csv);
                                downloadLink.attr('download', scope.getFilename());
                                $document.find('body').append(downloadLink);
                                $timeout(function () {
                                    downloadLink[0].click();
                                    downloadLink.remove();
                                }, null);
                            }
                        }
                    }
                    element.bind('click', function (e) {
                        scope.buildCSV().then(function (csv) {
                            doClick();
                        });
                        scope.$apply();
                    });
                }

from ng-csv.

Rmabini avatar Rmabini commented on July 26, 2024

Hi BerangereMartin,

Can you provide as a plunker , on how to used code , you have provided

Thanks

from ng-csv.

chaitujil avatar chaitujil commented on July 26, 2024

Same issue here. I am trying to use this directive in IE9. Doesn't work. Can someone post a plunker with the hack they did to make it work?

from ng-csv.

BerangereMartin avatar BerangereMartin commented on July 26, 2024

See my pull request i am sorry but no Time to make a plunker

from ng-csv.

lcampanis avatar lcampanis commented on July 26, 2024

Is this fix being merged soon?
Otherwise I'd be happy to provide a new pull request. We've made it work in IE9 as well.

Pull request: #150

from ng-csv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.