[Mono-dev] creating excel files

eng. Ahmed Youssef ahhatem at gmail.com
Sat Feb 26 07:04:18 EST 2011


Hello everyone,

Sorry for the late reply but I thought I do my homework first...

After moving to mono 2.10 on opensuse, I managed to make the library work on
mono.
The problem was with this scenario:

using System;
using System.IO.Packaging;
using System.IO;

namespace test
{
class MainClass
 {
public static void Main (string[] args)
{
 MemoryStream stream = new MemoryStream ();
Package p = Package.Open (stream, FileMode.Create, FileAccess.ReadWrite);
 p.Close ();
stream.ReadByte();
 }
}
}

throws this exception:

Unhandled Exception: System.ObjectDisposedException: The object was used
after being disposed.
  at System.IO.MemoryStream.CheckIfClosedThrowDisposed () [0x00000] in
/usr/src/packages/BUILD/mono-2.10/mcs/class/corlib/System.IO/MemoryStream.cs:133
  at System.IO.MemoryStream.ReadByte () [0x00000] in
/usr/src/packages/BUILD/mono-2.10/mcs/class/corlib/System.IO/MemoryStream.cs:261
  at test.MainClass.Main (System.String[] args) [0x00000] in <filename
unknown>:0


the package.Close call internally makes this:

public void Close()
{
this.Flush();
this.Dispose(1);
}

for some reason the dispose call disposes the stream too....

After replacing the package.Close() with package.Flush().... the EPPlus lib
works nicely....

I hope that is useful... I don't mind digging into the issue more but I am
not sure how to do that.... any info would be appreciated.
I hope you confirm that it is a mono issue and that it will be fixed so that
either mono is fixed or the library...

Thank you all for the help.


On Tue, Feb 22, 2011 at 7:11 PM, jmalcolm <malcolm.justin at gmail.com> wrote:

>
> I am not sure how big the spreadsheets are that you need to work with but I
> have used the free version of GemBox to great effect:
>
> http://www.gemboxsoftware.com/GBSpreadsheetFree.htm
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/creating-excel-files-tp3315324p3319632.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110226/b8cd9aa5/attachment.html 


More information about the Mono-devel-list mailing list