Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. ClosedXML odd behavior

ClosedXML odd behavior

Scheduled Pinned Locked Moved The Lounge
helpcsharpdotnetcomsysadmin
32 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K kmoorevs

    Firstly, I am not asking for help on a programming issue here. I'm mostly just trying to see if anyone else here is or has in the past been experiencing any problems using the ClosedXML .Net library to open/read Excel files. I have a simple process that has worked every day flawlessly for over 2 years, then out of the blue, started failing. :confused: Basically, ClosedXML was choking trying to open an Excel (*.xlsx) file. By choking, I mean it was an IO exception reporting that the file was corrupted. The weird thing is, I can copy that file to my desktop, open it in Excel, save it, copy it back to the server, and it works fine. :wtf: I am aware that a new version of OpenXML was released (right around the time that my process began failing???) with quite a few breaking changes. Coincidence?...I don't know yet. What's new in the Open XML SDK | Microsoft Learn[^] What I've tried: 0: Go to GitHub and get the latest ClosedXML libs. So this required a .net framework upgrade to 4.6+. No problem...compiles, go to open a spreadsheet and it complains about the XMLDocument version...go to GitHub, get that version and try again. It compiles fine, go to open a spreadsheet and now it whines about a netstandard library that it can't find. (sure this is an indication of inccompatibility) I tried different versions/combinations but the only way to get it working again was by reverting back to the original framework and original libraries. Back to square one. :doh: 1: Plead with the new IT guy responsible for scheduling that job to please change the format to CSV! :laugh: (the previous IT guy was on a power trip and refused to change it despite numerous requests) 2: Investigating the idea of simply extracting the sheet1.xml file from the archive and parsing it out. Then I wonder why if it was that easy, why there are so few solutions that mention this approach. It's possible that I'm looking at an extremely simple/limited structure (no formulas/formatting/etc.) in this particular file, but it looks feasible. In the event that #1 fails, this will probably be the next path of attack. 3: Install Excel on the customer's server. Ya know, they did give me an admin account so in theory, I can install anything required to get the job done. Also, I have an old Office 2007 disk around here that

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #12

    Never used it. What are you trying to do with it? Because I only needed to read it, I rolled my own XLSX reader.

    1 Reply Last reply
    0
    • K kmoorevs

      Firstly, I am not asking for help on a programming issue here. I'm mostly just trying to see if anyone else here is or has in the past been experiencing any problems using the ClosedXML .Net library to open/read Excel files. I have a simple process that has worked every day flawlessly for over 2 years, then out of the blue, started failing. :confused: Basically, ClosedXML was choking trying to open an Excel (*.xlsx) file. By choking, I mean it was an IO exception reporting that the file was corrupted. The weird thing is, I can copy that file to my desktop, open it in Excel, save it, copy it back to the server, and it works fine. :wtf: I am aware that a new version of OpenXML was released (right around the time that my process began failing???) with quite a few breaking changes. Coincidence?...I don't know yet. What's new in the Open XML SDK | Microsoft Learn[^] What I've tried: 0: Go to GitHub and get the latest ClosedXML libs. So this required a .net framework upgrade to 4.6+. No problem...compiles, go to open a spreadsheet and it complains about the XMLDocument version...go to GitHub, get that version and try again. It compiles fine, go to open a spreadsheet and now it whines about a netstandard library that it can't find. (sure this is an indication of inccompatibility) I tried different versions/combinations but the only way to get it working again was by reverting back to the original framework and original libraries. Back to square one. :doh: 1: Plead with the new IT guy responsible for scheduling that job to please change the format to CSV! :laugh: (the previous IT guy was on a power trip and refused to change it despite numerous requests) 2: Investigating the idea of simply extracting the sheet1.xml file from the archive and parsing it out. Then I wonder why if it was that easy, why there are so few solutions that mention this approach. It's possible that I'm looking at an extremely simple/limited structure (no formulas/formatting/etc.) in this particular file, but it looks feasible. In the event that #1 fails, this will probably be the next path of attack. 3: Install Excel on the customer's server. Ya know, they did give me an admin account so in theory, I can install anything required to get the job done. Also, I have an old Office 2007 disk around here that

      pkfoxP Offline
      pkfoxP Offline
      pkfox
      wrote on last edited by
      #13

      I've used [NPOI](https://github.com/dotnetcore/NPOI) for years without any problems

      In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP

      K 1 Reply Last reply
      0
      • P PIEBALDconsult

        Avoid Interop.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #14

        I have used it on a number of occasions and it works well.

        P 1 Reply Last reply
        0
        • K kmoorevs

          Firstly, I am not asking for help on a programming issue here. I'm mostly just trying to see if anyone else here is or has in the past been experiencing any problems using the ClosedXML .Net library to open/read Excel files. I have a simple process that has worked every day flawlessly for over 2 years, then out of the blue, started failing. :confused: Basically, ClosedXML was choking trying to open an Excel (*.xlsx) file. By choking, I mean it was an IO exception reporting that the file was corrupted. The weird thing is, I can copy that file to my desktop, open it in Excel, save it, copy it back to the server, and it works fine. :wtf: I am aware that a new version of OpenXML was released (right around the time that my process began failing???) with quite a few breaking changes. Coincidence?...I don't know yet. What's new in the Open XML SDK | Microsoft Learn[^] What I've tried: 0: Go to GitHub and get the latest ClosedXML libs. So this required a .net framework upgrade to 4.6+. No problem...compiles, go to open a spreadsheet and it complains about the XMLDocument version...go to GitHub, get that version and try again. It compiles fine, go to open a spreadsheet and now it whines about a netstandard library that it can't find. (sure this is an indication of inccompatibility) I tried different versions/combinations but the only way to get it working again was by reverting back to the original framework and original libraries. Back to square one. :doh: 1: Plead with the new IT guy responsible for scheduling that job to please change the format to CSV! :laugh: (the previous IT guy was on a power trip and refused to change it despite numerous requests) 2: Investigating the idea of simply extracting the sheet1.xml file from the archive and parsing it out. Then I wonder why if it was that easy, why there are so few solutions that mention this approach. It's possible that I'm looking at an extremely simple/limited structure (no formulas/formatting/etc.) in this particular file, but it looks feasible. In the event that #1 fails, this will probably be the next path of attack. 3: Install Excel on the customer's server. Ya know, they did give me an admin account so in theory, I can install anything required to get the job done. Also, I have an old Office 2007 disk around here that

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #15

          kmoorevs wrote:

          .net framework upgrade to 4.6+ ... whines about a netstandard library that it can't find

          Which version did you actually upgrade to? .NET Standard 2.0 sort-of works with 4.6.1+, but it has several issues. Microsoft recommend using at least 4.7.2: .NET Standard - .NET | Microsoft Learn[^]


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          K 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            kmoorevs wrote:

            .net framework upgrade to 4.6+ ... whines about a netstandard library that it can't find

            Which version did you actually upgrade to? .NET Standard 2.0 sort-of works with 4.6.1+, but it has several issues. Microsoft recommend using at least 4.7.2: .NET Standard - .NET | Microsoft Learn[^]


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            K Offline
            K Offline
            kmoorevs
            wrote on last edited by
            #16

            Richard Deeming wrote:

            Which version did you actually upgrade to?

            4.6.1 first then 4.7.2. Neither worked. Back to 4.5.2. :)

            "Go forth into the source" - Neal Morse "Hope is contagious"

            Richard DeemingR 1 Reply Last reply
            0
            • pkfoxP pkfox

              I've used [NPOI](https://github.com/dotnetcore/NPOI) for years without any problems

              In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP

              K Offline
              K Offline
              kmoorevs
              wrote on last edited by
              #17

              pkfox wrote:

              NPOI

              Funny, the author of the spreadsheets show as Apache POI. Related?

              "Go forth into the source" - Neal Morse "Hope is contagious"

              pkfoxP 1 Reply Last reply
              0
              • K kmoorevs

                Richard Deeming wrote:

                Which version did you actually upgrade to?

                4.6.1 first then 4.7.2. Neither worked. Back to 4.5.2. :)

                "Go forth into the source" - Neal Morse "Hope is contagious"

                Richard DeemingR Offline
                Richard DeemingR Offline
                Richard Deeming
                wrote on last edited by
                #18

                Any particular reason? 4.7.2 will make your life much easier when you want to reference a .NET Standard 2.0 library, and I don't recall seeing any breaking changes. I think the only thing that "broke" for me was an ambiguous reference error for a custom extension method I'd written, which had the same name as one they added to the BCL in 4.7.2. :)


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                1 Reply Last reply
                0
                • L Lost User

                  I have used it on a number of occasions and it works well.

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #19

                  Not saying it doesn't.

                  L 1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Not saying it doesn't.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #20

                    But that was the implication from:

                    Quote:

                    Avoid Interop.

                    P 1 Reply Last reply
                    0
                    • L Lost User

                      But that was the implication from:

                      Quote:

                      Avoid Interop.

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #21

                      No it isn't.

                      L 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        No it isn't.

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #22

                        Well, what is your point?

                        P 1 Reply Last reply
                        0
                        • L Lost User

                          Well, what is your point?

                          P Offline
                          P Offline
                          PIEBALDconsult
                          wrote on last edited by
                          #23

                          Exactly what I said.

                          L 1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            Exactly what I said.

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #24

                            I see, just trolling.

                            P 1 Reply Last reply
                            0
                            • L Lost User

                              I see, just trolling.

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #25

                              Nope, just offering unsolicited advice.

                              L 1 Reply Last reply
                              0
                              • P PIEBALDconsult

                                Nope, just offering unsolicited advice.

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #26

                                Feel free not to bother in future.

                                P 1 Reply Last reply
                                0
                                • K kmoorevs

                                  pkfox wrote:

                                  NPOI

                                  Funny, the author of the spreadsheets show as Apache POI. Related?

                                  "Go forth into the source" - Neal Morse "Hope is contagious"

                                  pkfoxP Offline
                                  pkfoxP Offline
                                  pkfox
                                  wrote on last edited by
                                  #27

                                  Yes they ported it from POI

                                  In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    Feel free not to bother in future.

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #28

                                    And you needn't bother respond either.

                                    L 1 Reply Last reply
                                    0
                                    • K kmoorevs

                                      Firstly, I am not asking for help on a programming issue here. I'm mostly just trying to see if anyone else here is or has in the past been experiencing any problems using the ClosedXML .Net library to open/read Excel files. I have a simple process that has worked every day flawlessly for over 2 years, then out of the blue, started failing. :confused: Basically, ClosedXML was choking trying to open an Excel (*.xlsx) file. By choking, I mean it was an IO exception reporting that the file was corrupted. The weird thing is, I can copy that file to my desktop, open it in Excel, save it, copy it back to the server, and it works fine. :wtf: I am aware that a new version of OpenXML was released (right around the time that my process began failing???) with quite a few breaking changes. Coincidence?...I don't know yet. What's new in the Open XML SDK | Microsoft Learn[^] What I've tried: 0: Go to GitHub and get the latest ClosedXML libs. So this required a .net framework upgrade to 4.6+. No problem...compiles, go to open a spreadsheet and it complains about the XMLDocument version...go to GitHub, get that version and try again. It compiles fine, go to open a spreadsheet and now it whines about a netstandard library that it can't find. (sure this is an indication of inccompatibility) I tried different versions/combinations but the only way to get it working again was by reverting back to the original framework and original libraries. Back to square one. :doh: 1: Plead with the new IT guy responsible for scheduling that job to please change the format to CSV! :laugh: (the previous IT guy was on a power trip and refused to change it despite numerous requests) 2: Investigating the idea of simply extracting the sheet1.xml file from the archive and parsing it out. Then I wonder why if it was that easy, why there are so few solutions that mention this approach. It's possible that I'm looking at an extremely simple/limited structure (no formulas/formatting/etc.) in this particular file, but it looks feasible. In the event that #1 fails, this will probably be the next path of attack. 3: Install Excel on the customer's server. Ya know, they did give me an admin account so in theory, I can install anything required to get the job done. Also, I have an old Office 2007 disk around here that

                                      J Offline
                                      J Offline
                                      jschell
                                      wrote on last edited by
                                      #29

                                      kmoorevs wrote:

                                      ClosedXML .Net library to open/read Excel files....I am aware that a new version of OpenXML was released

                                      A commercial production application should be built using the following 1. Identify libraries used. 2. Copy those libraries to a source that is controlled by the company. 3. Those libraries should ONLY be updated manually. 4. When libraries are updated and a dependent application is rebuilt then all of the impacted functionality must be retested. Note that version identifiers should not be trusted. That is why step 2 is required. Version identifiers are nothing but a hint since nothing stops someone from updating a library and not changing the version number. If the above is not followed then it is quite possible to go for years without problems. Until the day something quite unexpected shows up.

                                      1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        Avoid Interop.

                                        A Offline
                                        A Offline
                                        adriancs
                                        wrote on last edited by
                                        #30

                                        Yes, I agree with this. Microsoft Office Interop will launch the actual Excel program in background as external process.

                                        1 Reply Last reply
                                        0
                                        • P PIEBALDconsult

                                          And you needn't bother respond either.

                                          L Offline
                                          L Offline
                                          Lost User
                                          wrote on last edited by
                                          #31

                                          If you don't post pointless or silly comments there will not be anything to respond to.

                                          P 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups