Subscript / Superscript not working

I am trying your Asposes.Cells component for .NET. The version reads 8.0.0.0.

The "FormattingSelectedCharacters" under the directory "C:\Aspose_Cells_NET-master\ProgrammersGuide\AsposeCells\WorkingWithDataFormatting\" suggests that subscript / superscript is not working.

Specifically, the subscript / superscript can be correctly rendered only without the preceding lines of setting Font properties.

//Setting the font of selected characters to bold
cell.Characters(6, 7).Font.IsBold = true;

//Setting the font color of selected characters to blue
cell.Characters(6, 7).Font.Color = Color.Blue;

cell.Characters(8, 1).Font.IsSubscript = true;
cell.Characters(9, 1).Font.IsSuperscript = true;
Could you help to comment whether there will be a fix ?

Just tried 8.0.2 from the following link, same problem exists.
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/default.aspx

Hi Jiaguo,

Thanks for your posting and using Aspose.Cells.

It could be because of some bug in Aspose.Cells. We need to investigate this issue. Could you please provide us your complete runnable sample code replicating this issue. We will look into it and log it in our database after running at our end so that it could be fixed.

Thanks for your help !

Program.cs:

//////////////////////////////////////////////////////////////////////////
// Copyright 2001-2013 Aspose Pty Ltd. All Rights Reserved.
//
// This file is part of Aspose.Cells. The source code in this file
// is only intended as a supplement to the documentation, and is provided
// "as is", without warranty of any kind, either expressed or implied.
//////////////////////////////////////////////////////////////////////////
using System.IO;

using Aspose.Cells;
using System.Drawing;

namespace FormattingSelectedCharacters
{
public class Program
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");

// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first(default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];

//Accessing the "A1" cell from the worksheet
Cell cell = worksheet.Cells["A1"];

//Adding some value to the "A1" cell
cell.PutValue("Visit Aspose!");

//Setting the font of selected characters to bold
cell.Characters(6, 7).Font.IsBold = true;

//Setting the font color of selected characters to blue
cell.Characters(6, 7).Font.Color = Color.Blue;

cell.Characters(8, 1).Font.IsSubscript = true;
cell.Characters(9, 1).Font.IsSuperscript = true;

//Saving the Excel file
workbook.Save(dataDir + "book1.xls");

}
}
}

Hi Jiaguo,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue with the latest version. When we comment these lines, it works fine but when we uncomment these lines, it does not work.

//Setting the font of selected characters to bold
// cell.Characters(6, 7).Font.IsBold = true; //uncommenting this line, it will not work

//Setting the font color of selected characters to blue
// cell.Characters(6, 7).Font.Color = Color.Blue; //uncommenting this line, it will not work

I have attached the output.xls file generated by the following code after commenting these lines and subscript and superscript are working.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42666.

C#


//Instantiating a Workbook object

Workbook workbook = new Workbook();


//Obtaining the reference of the first(default) worksheet by passing its sheet index

Worksheet worksheet = workbook.Worksheets[0];


//Accessing the “A1” cell from the worksheet

Cell cell = worksheet.Cells[“A1”];


//Adding some value to the “A1” cell

cell.PutValue(“Visit Aspose!”);


//Setting the font of selected characters to bold

// cell.Characters(6, 7).Font.IsBold = true; //uncommenting this line, it will not work


//Setting the font color of selected characters to blue

// cell.Characters(6, 7).Font.Color = Color.Blue; //uncommenting this line, it will not work


cell.Characters(8, 1).Font.IsSubscript = true;

cell.Characters(9, 1).Font.IsSuperscript = true;


//Saving the Excel file

workbook.Save(“output.xls”);


Thank you for your observation and prompt help !

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.0.2.2 and let us know your feedback.

Now the result is correct. Great work !

Hi,


Good to know that your issue is resolved by the new fix. Feel free contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.

Thank you very much ! :slight_smile:

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.