Row Style not Applying

Hi. Thanks for a great product. I'm using Aspose.Cells v3.9.1.2. I'm trying to set a row's style and it does not seem to apply to the row. I have tried saving the output out as SpreadSheetML and the style does not appear within the document, although the cell do refer to it. Attached is the designer spreadsheet I have been using. I have also included the code I have used to generate this issue and the saved SpreadsheetML. Thanks for all your help.

-- Joel


Code
using System.IO;
using Aspose.Cells;

namespace ClassLibrary1
{
[TestFixture]
public class Class1
{
[Test]
public void SetRowStyle()
{
Workbook workBook = new Workbook();
using (FileStream templateStream = new FileStream(“MediaPlanStyleBugTest.xls”, FileMode.Open, FileAccess.Read, FileShare.Read))
{
workBook.Open(templateStream);
}

		int curRow = 1;
		for (int setCounter = 0; setCounter < 2; setCounter ++)
		{
			for (int rowCounter = 0; rowCounter < 2; rowCounter++)
			{
				workBook.Worksheets[0].Cells[curRow, 0].PutValue("Test");
				if (rowCounter == 0)
				{
					workBook.Worksheets[0].Cells.Rows[curRow].Style = workBook.Styles["Shaded"];
				}
				curRow++;
			}
		}
		
		workBook.Save("MediaPlanStyleBugTest_Output.xls");
	}
}

}


SpreadsheetML
<?xml version="1.0" encoding="utf-8"?><?mso-application progid="Excel.Sheet"?>
<?xml:namespace prefix = x /> 3 <?xml:namespace prefix = o /> Joel Baranick AtlasDMT <?xml:namespace prefix = ss /> Test Test Test Test TESTA0 TESTA1 TESTA2 TESTB0 TESTB1 TESTB2 TESTC0 TESTC1 TESTC2 1 600 600 9 1280 1280 9 0 0 EVALUATION COPYRIGHT WARNING This file is created using EVALUATION VERSION of Aspose.Cells. Evaluation Limitations: 1 This EVALUATION LICENSE WARNING worksheet will be added to all worksheets created with Aspose.Cells. 2 The usage of this Evaluation Version in any Commercial Application is strongly PROHIBITED. 3 Any Violation to the Usage Policies of this Product shall require a mandatory purchase of pay license as well as expose the user to other legal recourse for collection and punitive damages. 9 0 0

Please try this attached version.

This does not fix the issue. I simplified my test case even more.

Code

01 |	[Test]
02 | public void SetRowStyle()
03 | {
04 | License license = new License();
05 | license.SetLicense(@“C:\AtlasAssembly\Aspose.Excel.lic”);
06 |
07 | Workbook workBook = new Workbook();
08 |
09 | using (Stream templateStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(“Aspose.Cells.Test.Book1.xls”))
10 | {
11 | workBook.Open(templateStream);
12 | }
13 |
14 | Style shadedStyle = workBook.Styles[“Shaded”];
15 |
16 | workBook.Worksheets[0].Cells[3, 0].PutValue(“Test”);
17 | workBook.Worksheets[0].Cells.Rows[3].Style = shadedStyle;
18 |
19 | workBook.Save(@“C:\TestOutput.xls”, FileFormatType.SpreadsheetML);
20 |
21 | Workbook workBook2 = new Workbook();
22 | workBook2.Open(@“C:\TestOutput.xls”, FileFormatType.SpreadsheetML);
24 |
25 | StyleAssert.AreEqual(shadedStyle, workBook.Worksheets[0].Cells.Rows[3].Style);
26 | }
The SpreadsheetML that this saves is:

SpreadsheetML
<?xml version="1.0" encoding="utf-8"?><?mso-application progid="Excel.Sheet"?>
<?xml:namespace prefix = x /> 0 <?xml:namespace prefix = o /> John Doe Red Herring <?xml:namespace prefix = ss /> Test 9 0 0


When run, this code fails on line 22 with the following exception.

Exception
System.Exception: Error in opening SpreadsheetML file.

at Aspose.Cells.Workbook.Open(String fileName, FileFormatType type) 
at Aspose.Cells.Test.Class1.SetRowStyle() in class1.cs:line 51 

Aspose.Cells.Converter.ღ: Line 69: Invalid value "S17"

at Aspose.Cells.Converter.Ⴠ.ი(Worksheet ԙ, XmlTextReader ჉, Hashtable ր) 
at Aspose.Cells.Converter.Ⴠ.თ(XmlTextReader ჉, Hashtable ր) 
at Aspose.Cells.Converter.Ⴠ.჋(XmlTextReader ჉) 
at Aspose.Cells.Converter.Ⴠ.Import(Stream src, Workbook excel) 
at Aspose.Cells.Workbook.Open(String fileName, FileFormatType type)


When trying to open the resultant SpreadsheetML, Excel writes the following into its error log at C:\Documents and Settings\\Local Settings\Temporary Internet Files\Content.MSO\.log.

Excel Log
XML ERROR in Table
REASON:	Bad Value
FILE:	C:\Documents and Settings\\Desktop\TestOutput.xls
GROUP:	Table
TAG:	Row
ATTRIB:	StyleID
VALUE:	S17

XML ERROR in Table
REASON:	Bad Value
FILE:	C:\Documents and Settings\\Desktop\TestOutput.xls
GROUP:	Row
TAG:	Cell
ATTRIB:	StyleID
VALUE:	S16



A file saved as FileFormatType Default, Excel97, Excel2000, ExcelXP, or Excel2003 can be opened, but the row is not styled.Trying the same set of tests styling only a single cell causes the same results. Attached is the designer sheet that was used in this test. It you have any more questions, just let me know. Thanks.

-- Joel

Your book1.xls is a little strange compared with other Excel files. How do you create it?

Anyway, I fixed Aspose.Cells based on your file. Please try this attached version.

Thanks. That seems to fix the issue I was having. I'm not sure how it was created. I have inherited the sheet I'm using in production from a legacy system. What was odd about the sheet? Thanks again.

-- Joel

You files lost some records normally contained in an MS Excel created file. We haven’t found this issue before.