Can I use the Open XML SDK in Mono?
Asked Answered
F

4

10

Can the Open XML SDK be used in Mono?

Foresheet answered 26/5, 2011 at 21:11 Comment(4)
It's a question alright: what's wrong with the question being in the title?Foresheet
@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.Bankruptcy
@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...Foresheet
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.Carbonyl
O
11

Edit: It seems to be working in the meantime: https://mcmap.net/q/1055174/-can-i-use-the-open-xml-sdk-in-mono

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.

Omentum answered 3/8, 2011 at 18:32 Comment(1)
Please note that I did not every try it again. According to https://mcmap.net/q/1055174/-can-i-use-the-open-xml-sdk-in-mono it should work now!Omentum
G
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

Gallnut answered 4/2, 2015 at 13:19 Comment(1)
As of June the SDK has gone OpenSource. Back in 2011 it wasn't possible.Rhinencephalon
S
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

Sandler answered 30/5, 2011 at 10:32 Comment(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.Bankruptcy
@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?Offwhite
B
-1

Yes, the SDK can be used in Mono.

Bankruptcy answered 29/5, 2011 at 19:27 Comment(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.Ibiza
It was, however, the first answer, so it is not in disregard of the other (better) answers.Slype

© 2022 - 2024 — McMap. All rights reserved.