Problem w/Existing Styles in a template spreadsheet

If I apply a style that exists in the template spreadsheet that I'm updating the resulting spreadsheet does not reflect that style. Please let me know what I'm doing incorrectly.

Thanks,

Andy

Exmaple code:

static void Main(string[] args)

{

int baseRow = 9;

byte baseCol = 0;

Workbook xl = new Workbook();

xl.Open("Distribution Report Template.xls", Aspose.Cells.FileFormatType.Excel2003);

// New sheet

Worksheet sheet = xl.Worksheets[ xl.Worksheets.AddCopy( "Template" ) ];

sheet.Name = "A";

// Some data

System.Data.DataTable t = new System.Data.DataTable();

t.Columns.Add(new System.Data.DataColumn("Value", System.Type.GetType("System.String")));

t.Columns.Add(new System.Data.DataColumn("Ct", System.Type.GetType("System.Int32")));

t.Columns.Add(new System.Data.DataColumn("Pct", System.Type.GetType("System.Double")));

t.Columns.Add(new System.Data.DataColumn("Last Ct", System.Type.GetType("System.Int32")));

t.Columns.Add(new System.Data.DataColumn("Last Pct", System.Type.GetType("System.Double")));

object[] a = new object[5];

a[0] = "Test";

a[1] = 100;

a[2] = 0.1;

a[3] = 100;

a[4] = 0.1;

t.Rows.Add(a);

Row _row = sheet.Cells.Rows[11];

// Simple Style created in the template opened above.

Style stl1 = xl.Styles["ValueHeader"];

StyleFlag _allFlag = new StyleFlag();

_allFlag.All = true;

_row.ApplyStyle(stl1, _allFlag);

try

{

sheet.Cells.ImportDataTable

( t

, false

, baseRow+1

, baseCol

, false );

}

catch (Exception ex)

{

Console.WriteLine(ex.ToString());

}

xl.Save("test.xls");

}

}

Hi,

Thanks for considering Aspose.

We found the issue with named styles in the template file which cannot be properly applied, we will figure it out soon.

Thank you.

Hi,

We have fixed this bug.

Please try this fix.

Thanks so much Warren… but where do I grab the fix?

Hi,

Sorry for missing the attachment.

Kindly try it now.

Thank you.

Great… that solves my problem. I can use the template’s styles without issue now. Thanks for the prompt reply and fix.

They are now telling me I need to move the project from .Net 1.0 to .Net 2.0... is this patch in the .Net 2.0 release as well?

Hi,

Well the fix is compiled on .NET 1.x which will work equally fine on .NET 2.0, 3.0 etc. You may use it without any problem. If you require .NET 2.0 compiled version, we can attach it here.

Thank you.