The following code does not work as I expected at the InsertRows call (below) using the DLL that you provided in a prior post. IU was expecting InsertRows to produce 10 rows having "drop-down" options in the second column, followed by an "end of data" marker on the very last line of the worksheet. Instead, the "end of data" marker is row 3.
[TestMethod]
public void InsertRows_1() // doesn't work in 3.7.2.2
{
Excel excel = new Excel();
Cells cells = excel.Worksheets[0].Cells;
Range range = null;
ArrayList headings = new ArrayList();
headings.Add("Empty Column");
headings.Add("Heading1");
cells.ImportArrayList(headings, 0, 0, false);
cells[1, 1].PutValue("value[1,1]");
int indexOfLastDataColumn = cells.MaxDataColumn;
int indexOfLastDataRow = cells.MaxDataRow;
Worksheet worksheet = excel.Worksheets[0];
Styles styles = excel.Styles;
Validations validations = worksheet.Validations;
CellArea cellArea = new CellArea();
ArrayList list = new ArrayList();
int i = 0;
string rangeName = ("MyRange");
i = excel.Worksheets.Add();
Worksheet sheet = excel.Worksheets;
Cells listing = sheet.Cells;
ArrayList items = new ArrayList();
items.Add("Apple");
items.Add("Banana");
items.Add("Carrot");
listing.ImportArrayList(items, 0, 0, true);
range = listing.CreateRange(0, 0, items.Count, 1);
range.Name = rangeName;
sheet.AutoFitColumn(0);
i = validations.Add();
validations.Type = ValidationType.List;
validations.Operator = OperatorType.None;
validations.ShowInput = false;
validations.IgnoreBlank = true;
validations.InCellDropDown = true;
validations.AlertStyle = ValidationAlertType.Warning;
validations.ErrorMessage = "Value not in list";
validations.Formula1 = string.Format("={0}", rangeName);
cellArea = new CellArea();
cellArea.StartRow = 1;
cellArea.EndRow = indexOfLastDataRow;
cellArea.StartColumn = 1;
cellArea.EndColumn = 1;
list = validations.AreaList;
list.Add(cellArea);
for (int j = 0; j < 2; j++)
{
worksheet.AutoFitColumn(j);
}
// This does not insert rows!
cells.InsertRows(2, 10);
i = styles.Add();
styles.Font.IsBold = true;
styles.ForegroundColor = System.Drawing.Color.Yellow;
styles.Font.Color = System.Drawing.Color.Blue;
// Required by Aspose.Cells 3.7.2 for background colors to work:
styles.Pattern = BackgroundType.Solid;
int lastRowNumber = cells.MaxDataRow + 1;
Row row = cells.Rows[lastRowNumber];
row.Style = styles;
Cell cell = cells[lastRowNumber, 0];
cell.PutValue("End of data");
excel.Save("InsertRowsTests_1.xls");
}