Licensed version creates problems for inheriting from Excel class

Hi,
I built a class that inherits Aspose’s Excel class. However I cannot get the license file to work with my inherited class. In .NET you cannot inherit a constructor, so I built a constructor that allows for the licence file as a parm. The problem is that I do not have a reference to this instance of your class. This means that the object of type IHSExcel still is not pointing at the license file and I still get the watermark with “This file is created with Aspose.Excel for evaluation only with an Evaluation License. etc.”. I do not want to have to change my code that relies on this inherited version of aspose’s Excel class. Can you expose a property that I can set with the license file rather than putting it in the constructor? It would make it so much easier to inherit from you Excel class and expand it’s funtionality seamlessly. Maybe I’m missing something, but I think unless you create a property for the license file, I will have to change my code and methods to pass around an instance of your Excel class for this to work. This defeats my purpose of inheriting from your Excel class.

Much Appreciated,

Glenn Engelbart


public class IhsExcel : Excel
{
//Purpose: Extends Aspose’s Excel class. Allows caller to easilly setup, populate, and display Excel workbooks.
public IhsExcel(string licenseFile, System.Web.UI.Page page)
{
Excel excel = new Excel(licenseFile, page);
}

public IhsExcel()
{
}

public void SetDesignerFile(string designerFilePath)
{
//Purpose: Links workbook object to a template workbook.

try
{
Open(designerFilePath);
}
catch
{
throw new Exception("File not found at " + designerFilePath);
}
}

public Worksheet CreateWorksheet(string sheetName)
{
//Purpose: Create a worksheet in a workBook.
Worksheets sheets = Worksheets;

//Add a worksheet
sheets.Add();
int currentSheet = sheets.Count-2; //1 for aspose notification & 1 to convert to 0 based.
//Change the name of a worksheet
sheets[currentSheet].Name = sheetName;

Worksheet sheet = Worksheets[currentSheet];
return sheet;
}

public int ImportDataTable(Worksheet sheet, DataTable dataTable, int startRow, byte startCol)
{
//Purpose: Places DataTable at specified location on sheet.
Cells cells = sheet.Cells;
sheet.Cells.ImportDataTable(dataTable, false, startRow, startCol);
int endRow = startRow+ dataTable.Rows.Count;
return endRow;
}

}// END CLASS DEFINITION XExcel



//Create and populate excel workbook

//IhsExcel excel = new IhsExcel();
string licenseFile = MapPath(“License”) + “\Aspose.Excel.lic”;
IhsExcel excel = new IhsExcel(licenseFile, this);
string designerFile = MapPath(“MDXIQ2.xls”);
excel.SetDesignerFile(designerFile);
Worksheet sheet = excel.CreateWorksheet(“test”);
excel.ImportDataTable(sheet, ds1.Tables[“Headers”],6,0);
excel.ImportDataTable(sheet, ds1.Tables[“Data”],7,0);


Sorry about that, A friend helped me figure it out. I just have to change my Derived class’ constructor methods to the following and it worked fine:

public IhsExcel(string licenseFile, System.Web.UI.Page page) : base(licenseFile, page)
{
}

public IhsExcel() : base()
{
}