I wish to change my code to Spread Sheet Gear from Microsoft Office Interop OWC11. However, I face some problems in my code. The code show here is using the Microsoft.Office.Interop.Owc11, I do try with Spread Sheet Gear with some IWorkBook, IWorkSheet, using SpreadsheetGear; etc. But I still fail to change and get error that make my file messy. May you help to assist me on this issue? Changing the following code to SpreadsheetGear
TemplateManagerBLTest.cs
using Microsoft.Office.Interop.Owc11;
public void FindRangeTest()
{
TemplateManagerBL target = new TemplateManagerBL();
TestBusinessLogic.BusinessLogic_TemplateManagerBLAccessor accessor = new TestBusinessLogic.BusinessLogic_TemplateManagerBLAccessor(target);
string rangeKeyword = "END";
AxSpreadsheet currentSpreadSheet = GetTestSheet("..\\..\\..\\TestBusinessLogic\\TemplateManagerTestData\\TEST_TemplateForGetRangeTest.xml");
int expectedCol, expectedRow;
expectedCol = 1;
expectedRow = 306;
TemplateManagerBL.Coordinate actual;
actual = accessor.FindRange(rangeKeyword, currentSpreadSheet);
Assert.AreEqual(expectedCol, actual.Column, "FindRange did not return the expected column value.");
Assert.AreEqual(expectedRow, actual.Row, "FindRange did not return the expected column value.");
}
Inside GetTestSheet
#region "Test Data Methods"
private AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet GetTestSheet(string filePath)
{
AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet currentSpreadSheet;
string tXML = "";
TextReader textReader = new StreamReader(@filePath);
while (textReader.ReadLine() != null)
{
tXML = textReader.ReadToEnd();
}
TemplateControl tc = new TemplateControl();
currentSpreadSheet = new AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet();
currentSpreadSheet = tc.SpreadSheet;
currentSpreadSheet.XMLData = tXML;
return currentSpreadSheet;
}
Inside FindRange
internal global::BusinessLogic.TemplateManagerBL.Coordinate FindRange(string rangeKeyword, global::AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet currentSpreadSheet)
{
object[] args = new object[] {
rangeKeyword,
currentSpreadSheet};
global::BusinessLogic.TemplateManagerBL.Coordinate ret = ((global::BusinessLogic.TemplateManagerBL.Coordinate)(m_privateObject.Invoke("FindRange", new System.Type[] {
typeof(string),
typeof(global::AxMicrosoft.Office.Interop.Owc11.AxSpreadsheet)}, args)));
return ret;
}