MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Setting the ResultFormat in a ASP.NET WebApplication.

  • To: mathgroup at
  • Subject: [mg55007] Re: Setting the ResultFormat in a ASP.NET WebApplication.
  • From: "Hans Michel" <hmichel at>
  • Date: Wed, 9 Mar 2005 06:34:32 -0500 (EST)
  • References: <d0e6mf$orp$> <d0jut4$n6c$>
  • Reply-to: "Hans Michel" <hmichel at>
  • Sender: owner-wri-mathgroup at


Sorry this is VB.NET you'll have to translate.

            MathKernel1.GraphicsHeight = 100
            MathKernel1.GraphicsWidth = 100
            MathKernel1.CaptureGraphics = True
            MathKernel1.ResultFormat = 
            MathKernel1.Compute("3 + 2")

            If TypeOf MathKernel1.Result Is System.Drawing.Image Then
            End If

I'm using the latest .NET/Link I did not need a temp image Bitmap Object. 
Result.Save when TraditionalForm is enumerated takes on the type 

I think all you need is

if(Global.mathKernel.Result is System.Drawing.Image)
System.Drawing.Imaging.ImageFormat.Jpeg) ;
Else you can output blank bitmap.


I think some of you may need to use some "using" declaration to include 
class namespaces thus you can keep your scope short.

On another note which IDE are you using to generate the ASP.NET code?

If you are doing this from scratch consider using
It allows class browsing which is what I think you need so you can look at 
what the properties /methods need as input.
No intellisense.
Review about it

Eclispse and .NET Framework SDK

I would not recommend using the Free Microsoft Express tools. (But its free)

They require using the .NET Framework 2.0 which is a beta.I don't know it it 
can exist side by side with .NET Framework 1.0 or 1.1.

"Javier Chicote" <goraperas at> wrote in message 
news:d0jut4$n6c$1 at
> Hi again,
> I've been trying the different types of ResultFormat. I'm interested to 
> show
> in my application the result of a computation in a smart way, rather than
> the string that I get when the ResultFormatType is OutputForm.
> I looked at the documentation and saw that the mathKernel.result is a 
> string
> when the ResultFormat is InputForm, OutputForm or MahML, a Image when the
> ResultFormat is StandardForm or TraditionalForm and a Expr when the
> ResultFormat is Expr. However, I got some errors when I'm using these 
> types:
> 1) OutputForm is the default, and it worked OK.
> 2) InputForm and Expr worked OK too, but it is not exactly what I am 
> looking
> for.
> 3) With MathML, I obtanined an error here:
>        Global.mathKernel.ResultFormat =
> Wolfram.NETLink.MathKernel.ResultFormatType.MathML;
>        Global.mathKernel.Compute("2+3"); //ERROR
> 4) With StandardForm or TraditionalForm I cannot see the image in the
> WebApplication if I take the following steps:
> * On WebForm1 HTML code:
>        <IMG id="resultsImage" style="Z-INDEX: 102; LEFT: 24px; WIDTH:
> 360px; POSITION: absolute; TOP: 312px; HEIGHT: 88px" height="88" alt=""
> src="Results.aspx" width="360" runat="server">
> * Results.aspx. code:
>        <%@ Page language="c#" Codebehind="Results.aspx.cs"
> AutoEventWireup="false" Inherits="MathKernelAppWeb.Results"
> enableViewState="False" contentType="image/jpeg"%>
> * Results.aspx.cs code:
>        protected System.Drawing.Image image;
>        private void Page_Load(object sender, System.EventArgs e) {
>               image = (System.Drawing.Image) Global.mathKernel.Result;
>                image.Save(Response.OutputStream, ImageFormat.Jpeg);
>        }
> Thank you very much for your time.
> Best regards,
> Javier Chicote
> "Todd Gayley" <tgayley at> escribió en el mensaje
> news:d0e6mf$orp$1 at
>> At 12:34 AM 3/5/2005, Javier Chicote wrote:
>> >Hi,
>> >
>> >The ResultFormat of the MathKernel is set to "OutputForm" as default, 
>> >and
> I
>> >would like to set it to other ResultFormatTypes, like "StandardForm" or
>> >"MathML". How can I do this? It says that I cannot convert a string to
>> >'Wolfram.NETLink.MathKernel.ResultFormatType' when I do like this:
>> >
>> >Global.mathKernel.ResultFormat = "StandardForm";
>> >
>> >or like this:
>> >
>> >Global.mathKernel.ResultFormat =
>> >(Wolfram.NETLink.MathKernel.ResultFormatType) "StandardForm";
>> >
>> >How can I set the ResultFormat then?
>> Javier,
>> ResultFormatType is an enum, so you use its values like this:
>>      Global.mathKernel.ResultFormat =
> MathKernel.ResultFormatType.StandardForm;
>> Todd Gayley
>> Wolfram Research

  • Prev by Date: Google's aptitude test equation
  • Next by Date: Re: SQLSelect
  • Previous by thread: Re: Setting the ResultFormat in a ASP.NET WebApplication.
  • Next by thread: Re: Setting the ResultFormat in a ASP.NET WebApplication.