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

Free Support Forum - aspose.com

Subscript property affects Superscript property

I am using Aspose.Words 6.0.0.0. I found that when turning on superscript, if I turn off subscript afterwards in the code, it turns off superscript aswell. My workaround for this is I only set one or the other, not set one to true and the other to false. Here is my code I was using.

_docBuilder.Font.Superscript = false;

_docBuilder.Font.Subscript = false;

_docBuilder.InsertParagraph();

_docBuilder.Write("normal ");

_docBuilder.Font.Superscript = true;

_docBuilder.Write("superscript");

_docBuilder.Font.Superscript = false;

_docBuilder.Font.Subscript = false;

_docBuilder.InsertParagraph();

_docBuilder.Write("normal ");

_docBuilder.Font.Superscript = true;

_docBuilder.Font.Subscript = false;

_docBuilder.Write("superscript");

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

Thanks for your request. I managed to reproduce the problem and created new issue #7164 in our defect database. I will notify you as soon as it is fixed.

The following code works as expected.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Insert normal text

builder.Write("normal ");

//Insert superscript text

builder.Font.Superscript = true;

builder.Write("superscript");

//reset superscript

builder.Font.Superscript = false;

builder.InsertParagraph();

//Inset normal text

builder.Write("normal ");

//Insert subscript text

builder.Font.Subscript = true;

builder.Write("subscript");

//reset superscript

builder.Font.Subscript = false;

builder.InsertParagraph();

//Insert superscript text

builder.Font.Superscript = true;

builder.Write("superscript");

//Insert subscript text

builder.Font.Subscript = true;

builder.Write("subscript");

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

Best regards.

Hi,

Thanks for the quick reply. It is very much appreciated.

Internally, Subscript and Superscript is a single attribute in Word documents - Vertical Alignment for Text Runs. It can be Baseline, Superscript or Basescript.

Aspose.Words has two boolean properties Font.Superscript and Font.Subscript because it was modeled after MS Word Automation. I now see this is confusing to users of the API, it should have been exposed as a single property, but we will probably leave the API the way it is.

To workaround just don't set Subscript after your modifed Superscript and vice versa. They seem to affect each other in your case.

Thanks for the feedback.

The issues you have found earlier (filed as 7164) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by alexey.noskov.

Thanks.