We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to create formula object

how to create formula object,
the formula sample pictures are in the attchment

Thanks very much!

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. The simplest way to insert formulas into the document is including them as images.

Another way is using EQ fields. Here is code example:

// Create empty document.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

// Insert some formula using EQ field.

// note: Aspsoe.Words does not update value of EQ fields, so you should update fieds in your document to the formula.

// You can learn more about switches used in EQ fields here:

// http://office.microsoft.com/en-us/word/HP051861481033.aspx

string eqFieldCode = @"EQ x=h\s\do8(0)-\r(h\s\do8(0)-\f(2;h))";

builder.InsertField(eqFieldCode, null);

// Save output document

doc.Save(@"Test001\out.doc");

But this approach requires to build equation expressions, which requires more effort. You can learn more about EQ fields here:

http://office.microsoft.com/en-us/word/HP051861481033.aspx

Hope this helps.

Best regards.


How can I insert equations in word with java?

your example will not work

String eqFieldCode = “EQ x=h\s\do8(0)-\r(h\s\do8(0)-\f(2;h))”;<o:p></o:p>

builder.insertField(eqFieldCode, null);

Do you have an idea?

Thanks

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java (4.0.2). I use the following code for testing:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

String eqFieldCode = "EQ x=h\\s\\do8(0)-\\r(h\\s\\do8(0)-\\f(2;h))";

builder.insertField(eqFieldCode, null);

doc.save("C:\\Temp\\out.doc");

The output document is attached.

Best regards,