10

Can the Open XML SDK be used in Mono?

4
  • 1
    It's a question alright: what's wrong with the question being in the title?
    – akosch
    May 27, 2011 at 18:38
  • @akosch: I think the downvotes are because of you lack of attention on creating a viable question. In other words, what version of the Open XML SDK? What have you tried? Did you read somewhere that it can't, but you want to see if there are workarounds? Etc. Maybe spend some time on the question and you'll get respondents who will also spend some time answering more than downvoting.
    – Todd Main
    May 28, 2011 at 3:11
  • 2
    @Otaku: I linked to an exact version of the SDK. I didn't find any viable sources so far on this topic (that's why I asked this question in the first place). I didn't try anything yet: that's why I didn't go into details about my experiences (there are simply none). I just wanted a simple answer to my simple question: yes or no...
    – akosch
    May 29, 2011 at 19:05
  • 1
    Note that questions, as per the FAQ/How-to-ask (stackoverflow.com/questions/how-to-ask), should also be relevant to others, and this question does not mention a specific version of mono. Thus, in time the question might have different answers and risk being closed then. In the meantime, I urge you to put a bit more text into your questions. In general, questions that only occur in the title are usually flagged as "low quality" and there is a general consensus that we don't want too many of those. May 30, 2011 at 19:57

4 Answers 4

11

Edit: It seems to be working in the meantime: https://stackoverflow.com/a/28322467/743897

Today (somewhere in 2011) I played around with the SDK and Mono 2.6.

First I checked what MoMA thinks of the dll:

4 different Methods in DocumentFormat.OpenXml.dll need the following method from Mono which is not available. At least according to MoMA.

void XmlReaderSettings.set_MaxCharactersInDocument (Int64)

But I was brave and tried to do stuff.

The bad thing: It didn't really work well for me. I managed to create a very simple docx with the content "Hello World" and then load and read the file again. But as soon as I wanted to open user created and more complex documents stuff started to crash and break. There are some nasty Null Pointer Exceptions lurking around and sometimes the opened file even gets destroyed. Maybe because of the one missing method. It's a pity.

Conclusion: At the moment the OpenXML SDK from Microsoft is not usable with Mono.

1
8

As of 2014 the SDK has gone open source. So, an updated answer is yes, check this latest screencast.

and it has been merged into the latest version. check the pull request: https://github.com/OfficeDev/Open-XML-SDK/pull/3

1
  • As of June the SDK has gone OpenSource. Back in 2011 it wasn't possible. Feb 19, 2015 at 18:31
4

No.

Refer this post and the comments as follows.

Zeyad Rajabi 13 Oct 2008 12:58 PM

@Christian – The SDK has not been ported to MONO, yet. We are still investigating. As for your question related to native code, the SDK is built entirely on .Net as such is managed code.

Zeyad Rajabi(MS)

Also refer this question where a user tried to use it and got an error.

Even the libraries section of mono refers a 3rd party tool:GemBoxSoftware

2
  • 2
    @akosch: This Sachin Chavan person just did an internet search and has not tried this. The SDK works just fine if: 1) You use version 2.0 (the post above is referring to version 1.0) and 2) You set a reference to WindowsBase (which System.IO.Packaging needs in Mono and VS). The reference on superuser is for someone who has not set a reference to WindowsBase. But again, you did not ask how this could be done, only if it could be done, to which the answer is yes. I've done it myself. You may also look at my tags on my profile page to see I know what I'm talking about.
    – Todd Main
    May 31, 2011 at 16:54
  • @Otaku, unfirtunately i can't confirm this... I'm trying to just call WordprocessingDocument.Open() on both Mono 2.10.8 and Mono 2.11 alpha. WindowsBase 3.0 is referenced. It results into a NullReferenceException... Should i open another question with complete information on this problem?
    – ILya
    Apr 9, 2012 at 15:48
-1
+50

Yes, the SDK can be used in Mono.

2
  • 2
    My quick experiments indicated it doesn't work, and toabi gave quite a detailed answer. This answer is either plain wrong or sadly lacking in any detail or references.
    – Draemon
    Feb 7, 2012 at 20:20
  • It was, however, the first answer, so it is not in disregard of the other (better) answers. Aug 27, 2012 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.