OfficeDev / Open-Xml-PowerTools

MIT License
692 stars 26 forks source link

Operation is not supported. #28

Closed bijiasuo2006 closed 8 years ago

bijiasuo2006 commented 8 years ago

Hi,

When i run the demo WmlToHtmlConverter01.exe get the error PtOpenXmlExtensions.GetXDocument throw exception 'Operation is not supported.'. Environment is Mono on Mac. How could I fix that?

Thanks,

Edison

EricWhiteDev commented 8 years ago

Hi Edison,

We haven't yet done the work to port to Mono on Mac, but it is on our list.

Can you please post a stack trace for the exception?

Thanks,

Eric

bijiasuo2006 commented 8 years ago

Hi Eric,

Below is the stack trace, hope that can help you.

OpenXmlPowerTools.PtOpenXmlExtensions.GetXDocument (part={DocumentFormat.OpenXml.Packaging.CoreFilePropertiesPart}) in /Users/Edison/Developer/Source/dotnet/open-xml-powertools/OpenXmlPowerTools/PtOpenXmlUtil.cs:68
WmlToHtmlConverterHelper.ConvertToHtml (file="../../5DayTourPlanTemplate.docx", outputDirectory="/Users/Edison/Developer/Source/dotnet/open-xml-powertools/OpenXmlPowerToolsExamples/WmlToHtmlConvert…") in /Users/Edison/Developer/Source/dotnet/open-xml-powertools/OpenXmlPowerToolsExamples/WmlToHtmlConverter01/WmlToHtmlConverter01.cs:67
WmlToHtmlConverterHelper.Main (args={string[0]}) in /Users/Edison/Developer/Source/dotnet/open-xml-powertools/OpenXmlPowerToolsExamples/WmlToHtmlConverter01/WmlToHtmlConverter01.cs:36

I am not sure if the Stream is different from Mac and Windows. But the error seems Stream on Mac has problem. The code on Windows works fine.

Cheers,

Edison

EricWhiteDev commented 8 years ago

Can you check whether the document is read-only? Also, what is the mode in which you are opening the document?

IIRC, there is an issue in opening documents in Mono where the document is read-only, or if the mode of opening is for read, not RW.

If this is the same bug as has been noted previously, if you make the document so that it is not read-only, and if you open for reading / writing (even if you don't write to the document) then it may work. Can you please let me know the results of this experiment?

bijiasuo2006 commented 8 years ago

Hi Eric,

Below is the inner exception, seems Mono's DeflateStream not support something.

  at System.IO.Compression.DeflateStream.get_Length () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr5/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.5/mcs/class/System/System.IO.Compression/DeflateStream.cs:297 
  at System.IO.Packaging.ZipWrappingStream.get_Length () [0x0004e] in <filename unknown>:0 
  at OpenXmlPowerTools.PtOpenXmlExtensions.GetXDocument (DocumentFormat.OpenXml.Packaging.OpenXmlPart part) [0x0001f] in /Users/Edison/Developer/Source/dotnet/open-xml-powertools/OpenXmlPowerTools/PtOpenXmlUtil.cs:54 

Is the information enough? Any other info you need let me know.

Cheers,

Edison

EricWhiteDev commented 8 years ago

Hmmm. This is probably going to need to wait until we do the proper port to Mono, on all the various platforms. Would you kindly do something - post an issue to https://github.com/OfficeDev/Open-Xml-Sdk? Please attach the document that the SDK is having troubles opening. That will enable us to create an XUnit test that fails on Mono.

I am going to push for higher priority to porting to Mono, and to Mono/Mac in particular. If we have an issue posted in the Open-Xml-Sdk, it will make it easier to get this fixed.