SmartMarkers Not Working with Integral DataTypes

I have a template employing SmartMarkers and so far it’s working with importing string and double data types, just not with integral types. Whenever I put a marker in the template for an integral column I get a NullReferenceException. The stack trace is below:

<br />Object reference not set to an instance of an object.<br /> at Aspose.Excel.Cell.get_StringValue()<br /> at Aspose.Excel.Cell.PutValue(Int32 intValue)<br /> at Aspose.Excel.Cell.PutValue(Object objectValue)<br /> at Aspose.Excel.Cells.ImportObjectArray(Object[] objArray, Int32 firstRow, Byte firstColumn, Boolean isVertical, Int32 skip)<br /> at Aspose.Excel.ExcelDesigner.a(Worksheet A_0, Cell A_1, Int32 A_2, Boolean A_3)<br /> at Aspose.Excel.ExcelDesigner.Process(Int32 sheetIndex, Boolean isPreserved)<br /> at Aspose.Excel.ExcelDesigner.Process(Boolean isPreserved)<br />
I’m filling a DataSet with a result from a stored procedure call to a Microsoft SQL server, its schema is below, so you can see the data types I’m importing into the designer object. I’m simply calling SetDataSource() with the DataSet object.
<br /><?xml version="1.0" encoding="utf-16"?><br /><xs:schema id="NewDataSet" xmlns="" xmlns:xs="<a class="linkification-ext" href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><br /> <xs:element name="NewDataSet" msdata:IsDataSet="true"><br /> <xs:complexType><br /> <xs:choice maxOccurs="unbounded"><br /> <xs:element name="Facilities"><br /> <xs:complexType><br /> <xs:sequence><br /> <xs:element name="DivisionID" type="xs:int" minOccurs="0" /><br /> <xs:element name="DivisionName" type="xs:string" minOccurs="0" /><br /> <xs:element name="RegionID" type="xs:int" minOccurs="0" /><br /> <xs:element name="RegionName" type="xs:string" minOccurs="0" /><br /> <xs:element name="FacilityID" type="xs:int" minOccurs="0" /><br /> <xs:element name="PercentDoneOnTime" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ecimal" minOccurs="0" /><br /> <xs:element name="PercentDoneLate" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ecimal" minOccurs="0" /><br /> <xs:element name="PercentSkipped" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ecimal" minOccurs="0" /><br /> <xs:element name="TasksCompleted" type="xs:int" minOccurs="0" /><br /> <xs:element name="TasksCompleted2" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ouble" minOccurs="0" /><br /> <xs:element name="FollowupNote" type="xs:string" minOccurs="0" /><br /> <xs:element name="FollowupID" type="xs:int" minOccurs="0" /><br /> <xs:element name="FacilityName" type="xs:string" minOccurs="0" /><br /> <xs:element name="City" type="xs:string" minOccurs="0" /><br /> <xs:element name="State" type="xs:string" minOccurs="0" /><br /> <xs:element name="Tiny" type="xs:unsignedByte" minOccurs="0" /><br /> <xs:element name="Small" type="xs:short" minOccurs="0" /><br /> <xs:element name="Big" type="xs:int" minOccurs="0" /><br /> <xs:element name="Floaty" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ecimal" minOccurs="0" /><br /> <xs:element name="SuperBig" type="xs:long" minOccurs="0" /><br /> </xs:sequence><br /> </xs:complexType><br /> </xs:element><br /> <xs:element name="Totals"><br /> <xs:complexType><br /> <xs:sequence><br /> <xs:element name="PercentDoneOnTime" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ecimal" minOccurs="0" /><br /> <xs:element name="PercentDoneLate" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ecimal" minOccurs="0" /><br /> <xs:element name="PercentSkipped" type="xs<img src="/forums/emoticons/emotion-2.gif" alt="Big Smile" />ecimal" minOccurs="0" /><br /> <xs:element name="TasksCompleted" type="xs:int" minOccurs="0" /><br /> </xs:sequence><br /> </xs:complexType><br /> </xs:element><br /> </xs:choice><br /> </xs:complexType><br /> </xs:element><br /></xs:schema><br />

I’m trying to import the “TasksCompleted” column using “&=Facilities.TasksCompleted”. I tried using some fake columns (see “Tiny” though “SuperBig” above) but they all gave the same error. As I said before, strings and doubles import just fine, why don’t my itegers work??

My designer file, DataSet schema and data, and the detailed page error are in here: ftp://ftp8yMwxR:bhD8vKq@ftp.directsupply.com/

Thanks for your help,
David Peters

Which version of Aspose.Excel are you using? I don’t find this problem in my machine.

Please download and try the latest hotfix at



If the problem still occurs, could you please send me your template and sample code? Thank you very much.

Tried the newest version (2.8.8.5) and still get the error. This FTP directory has my entire test project: ftp://ftp8yMwxR:bhD8vKq@ftp.directsupply.com/SmartMarkerStuff/

The default.aspx.htm is a copy of the error page I’m getting.

Thanks for your help Laurence, it’s appreciated.

I cannot access your ftp site but I find this problem finally. It’s fixed and v2.8.8.6 can be downloaded at

That did the trick! What in the hell was wrong, I’m suprised no one found that problem earlier.

By the way, what was the error w/ the FTP directory?

It always worked fine in previous version before mid of 2005/02. Since 2005/02, we did many internal optimization. I changed code while putting double values but forgot to change putting int values code. That introduces this tricky bug.

Thanks for your report.

Now I can access your ftp directory. It may be a connection problem while I acessed the site before.

I hope your forehead doesn’t hurt too much from smacking it! Big Smile

Thanks for the bugfix!

@DavidP,
Development for Aspose.Excel is stopped now and it is discarded. A new product Aspose.Cells is introduced that contains all the latest features available in different versions of MS Excel. It also supports SmartMarkers and works fine with integral data types. Here is an example to demonstrate this feature:

 class Product
    {
        public float Price { get; set; }
        public int Amount { get; set; }
    }

public static void Test()
{
    // Instantiating a WorkbookDesigner object
    WorkbookDesigner designer = new WorkbookDesigner();

    // Open a designer spreadsheet containing smart markers
    designer.Workbook = new Workbook("Designer.xlsx");
            
    DataSet dataSet = new DataSet("Sample");
    List<Product> Products = new List<Product>()
    {
        new Product(){ Price = 100, Amount = 2 },
        new Product(){ Price = 75.25f, Amount = 3 },
        new Product(){ Price = 25f, Amount = 5 },
    };
    DataTable ordersTable = ConvertToDatatable(Products);
    ordersTable.TableName = "Data";
    dataSet.Tables.Add(ordersTable);

    // Set the data source for the designer spreadsheet
    designer.SetDataSource(dataSet);

    // Process the smart markers
    designer.Process();
    designer.Workbook.Save("Output.xlsx");
}
private static DataTable ConvertToDatatable<T>(List<T> data)
{
    PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(T));
    DataTable table = new DataTable();
    for (int i = 0; i < props.Count; i++)
    {
        PropertyDescriptor prop = props[i];
        if (prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
            table.Columns.Add(prop.Name, prop.PropertyType.GetGenericArguments()[0]);
        else
            table.Columns.Add(prop.Name, prop.PropertyType);
    }

    object[] values = new object[props.Count];
    foreach (T item in data)
    {
        for (int i = 0; i < values.Length; i++)
        {
            values[i] = props[i].GetValue(item);
        }
        table.Rows.Add(values);
    }
    return table;
}

Here is a detailed article for SmartMarkers:
Using Smart Markers

The latest trial version of this product can be downloaded here:
Aspose.Cells for .NET (Latest Version)

To test the different features of Aspose.Cells a complete solution can be downloaded here.