Re: Setting the ResultFormat in a ASP.NET WebApplication.
- To: mathgroup at smc.vnet.net
- Subject: [mg54977] Re: Setting the ResultFormat in a ASP.NET WebApplication.
- From: "Javier Chicote" <goraperas at hotmail.com>
- Date: Tue, 8 Mar 2005 05:04:32 -0500 (EST)
- References: <d0e6mf$orp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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 wolfram.com> escribió en el mensaje news:d0e6mf$orp$1 at smc.vnet.net... > 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 >