public void Initialize(XlLocation insertAt) { // This did not initialize everything //RedContent = new CellFormatSpecification("RedContent"); RedContent = insertAt.CreateCellFormat("RedContent", insertAt.ContentLeftFormat); //XlLocation.InitializeFont(insertAt.ContentLeftFormat, RedContent); RedContent.Font.Color = Color.Red; RedContent.Font.Bold = true; WITContent = insertAt.CreateCellFormat("WITContent", insertAt.ContentLeftFormat); //XlLocation.InitializeFont(insertAt.ContentLeftFormat, WITContent); WITContent.Font.Color = Color.Green; WITContent.Font.Bold = true; DateLabel = insertAt.CreateCellFormat("DateLabel", insertAt.LabelRightFormat); //XlLocation.InitializeFont(insertAt.LabelRightFormat, DateLabel); DateLabel.Font.Color = Color.DarkOrange; DateContent = insertAt.CreateCellFormat("DateContent", insertAt.ContentLeftFormat); //XlLocation.InitializeFont(insertAt.ContentLeftFormat, DateContent); DateContent.Font.Color = Color.Orange; DateContent.Font.Bold = true; IsInitialized = true; }
public XlLocation AddRow(int columns = 0) { if (Common.DisplayXlLocationUpdates) { StackFrame frame = new StackFrame(1); MethodBase caller = frame.GetMethod(); Excel.DisplayInWatchWindow(this, caller.Name); } // nextRange is currently where new output should be. CurrentRange = nextRange; //Range rngOutput = currentRange; XlLocation currentLocation = this; // Update to reflect new row. RowsAdded++; nextRange = nextRange.Offset[1, 0]; ColumnOffset = columns; if (columns > ColumnsAdded) { ColumnsAdded = columns; } if (ColumnOffsetMax < ColumnOffset) { ColumnOffsetMax = ColumnOffset; } return(this); }