/** * Constructor used when copying a label from a read only * spreadsheet * * @param lc the label to copy */ protected LabelRecord(LabelCell lc) : base(Type.LABELSST, lc) { contents = lc.getString(); if (contents == null) { contents = string.Empty; } }
void AddCell() { var cell = new LabelCell { Title = "AddCell", ValueText = "addcell", Description = "add cell", HintText = "hint" }; switch (AddCellCount) { case 0: settings.Root[0].Insert(0, cell); break; case 1: settings.Root[0].Add(cell); break; case 2: settings.Root[0].Insert(settings.Root[0].Count / 2, cell); break; case 3: settings.Root[1].Insert(0, cell); break; case 4: settings.Root[1].Add(cell); break; case 5: settings.Root[1].Insert(settings.Root[1].Count / 2, cell); break; } AddCellCount++; if (AddCellCount > 5) { AddCellCount = 0; } }
/// <summary> Gets the cell whose contents match the string passed in. /// If no match is found, then null is returned. The search is performed /// on a row by row basis, so the lower the row number, the more /// efficiently the algorithm will perform. This method differs /// from the findCell methods in that only cells with labels are /// queried - all numerical cells are ignored. This should therefore /// improve performance. /// /// </summary> /// <param name="contents">the string to match /// </param> /// <returns> the Cell whose contents match the paramter, null if not found /// </returns> public virtual LabelCell findLabelCell(string contents) { LabelCell cell = null; bool found = false; for (int i = 0; i < Rows && !found; i++) { Cell[] row = getRow(i); for (int j = 0; j < row.Length && !found; j++) { if ((row[j].Type == CellType.LABEL || row[j].Type == CellType.STRING_FORMULA) && row[j].Contents.Equals(contents)) { cell = (LabelCell)row[j]; found = true; } } } return(cell); }
/** * Constructor used internally by the application when making a writable * copy of a spreadsheet being read in * * @param lc the label to copy */ public Label(LabelCell lc) : base(lc) { }
private CellModel PrepareCellModel(TreeNode tNode) { var cell = new CellModel { }; try { var contM = (tNode.Tag as ControlPropertyModel); switch (contM.ControlType.ToUpper()) { case "LABEL": var objlbl = contM.Properties as LabelCellGridClass; var parentLabel = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new LabelCell { Text = objlbl.Name, Font = new FontModel { FontFamily = objlbl.LabelFont.FontFamily.Name, FontSize = objlbl.LabelFont.Size }, Color = new ColorModel { Type = "RGB", Blue = objlbl.LabelColor.B, Green = objlbl.LabelColor.G, Red = objlbl.LabelColor.R }, ColSpan = parentLabel.ColSpan, RowSpan = parentLabel.RowSpan, PTop = parentLabel.PTop, PBottom = parentLabel.PBottom, PLeft = parentLabel.PLeft, PRight = parentLabel.PRight, BorderPattren = parentLabel.BorderPattren.ToString().Replace("_", ","), ContentType = "LABEL", HAlign = Master.Master.GetAlignmentNumber(parentLabel.HAlign), VAlign = Master.Master.GetAlignmentNumber(parentLabel.VAlign), Height = objlbl.Height }; break; case "FIELD": var objfld = contM.Properties as FieldCellGridClass; var parentField = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new FieldCell { DataFieldName = objfld.Name, ModelName = objfld.FieldModel, Font = new FontModel { FontFamily = objfld.FieldFont.FontFamily.Name, FontSize = objfld.FieldFont.Size }, Color = new ColorModel { Type = "RGB", Blue = objfld.FieldColor.B, Green = objfld.FieldColor.G, Red = objfld.FieldColor.R }, ColSpan = parentField.ColSpan, RowSpan = parentField.RowSpan, PTop = parentField.PTop, PBottom = parentField.PBottom, PLeft = parentField.PLeft, PRight = parentField.PRight, BorderPattren = parentField.BorderPattren.ToString().Replace("_", ","), ContentType = "FIELD", HAlign = Master.Master.GetAlignmentNumber(parentField.HAlign), VAlign = Master.Master.GetAlignmentNumber(parentField.VAlign), Height = objfld.Height }; break; case "EMPTY": var objempty = contM.Properties as EmptyCellGridClass; var parentEmpty = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new EmptyCell { Text = objempty.Name, ColSpan = parentEmpty.ColSpan, RowSpan = parentEmpty.RowSpan, PTop = parentEmpty.PTop, PBottom = parentEmpty.PBottom, PLeft = parentEmpty.PLeft, PRight = parentEmpty.PRight, BorderPattren = parentEmpty.BorderPattren.ToString().Replace("_", ","), ContentType = "EMPTYCELL", HAlign = Master.Master.GetAlignmentNumber(parentEmpty.HAlign), VAlign = Master.Master.GetAlignmentNumber(parentEmpty.VAlign) }; break; case "TABLE": var objtbl = contM.Properties as TableGridClass; var parentTable = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new TableCell { ColSpan = parentTable.ColSpan, RowSpan = parentTable.RowSpan, PTop = parentTable.PTop, PBottom = parentTable.PBottom, PLeft = parentTable.PLeft, PRight = parentTable.PRight, BorderPattren = parentTable.BorderPattren.ToString().Replace("_", ","), ContentType = "TABLECELL", TableHAlient = Master.Master.GetAlignmentNumber(parentTable.HAlign), TableVAlient = Master.Master.GetAlignmentNumber(parentTable.VAlign), tableModel = PrepareMainTable(tNode) }; break; case "IMAGEURL": var objimgUrl = contM.Properties as ImageUrlCellGridClass; var parentIU = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new ImageUrlCell { Src = objimgUrl.Src, Scale = objimgUrl.Scale, ColSpan = parentIU.ColSpan, RowSpan = parentIU.RowSpan, PTop = parentIU.PTop, PBottom = parentIU.PBottom, PLeft = parentIU.PLeft, PRight = parentIU.PRight, BorderPattren = parentIU.BorderPattren.ToString().Replace("_", ","), ContentType = "IMAGEURL", HAlign = Master.Master.GetAlignmentNumber(parentIU.HAlign), VAlign = Master.Master.GetAlignmentNumber(parentIU.VAlign), Height = objimgUrl.Height }; break; case "IMAGEBYTE": var objImgByte = contM.Properties as ImageByteCellGridClass; var parentIB = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new ImageByteCell { ImageFieldName = objImgByte.Name, ModelName = objImgByte.ImageFieldModel, Scale = objImgByte.Scale, ColSpan = parentIB.ColSpan, RowSpan = parentIB.RowSpan, PTop = parentIB.PTop, PBottom = parentIB.PBottom, PLeft = parentIB.PLeft, PRight = parentIB.PRight, BorderPattren = parentIB.BorderPattren.ToString().Replace("_", ","), ContentType = "IMAGEBYTE", HAlign = Master.Master.GetAlignmentNumber(parentIB.HAlign), VAlign = Master.Master.GetAlignmentNumber(parentIB.VAlign), Height = objImgByte.Height }; break; case "IMAGESUBURL": var objImgSubUrl = contM.Properties as ImageSubUrlCellGridClass; var parentISU = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new ImageUrlSubHeaderCell { Src = objImgSubUrl.Src, Scale = objImgSubUrl.Scale, ColSpan = parentISU.ColSpan, RowSpan = parentISU.RowSpan, PTop = parentISU.PTop, PBottom = parentISU.PBottom, PLeft = parentISU.PLeft, PRight = parentISU.PRight, BorderPattren = parentISU.BorderPattren.ToString().Replace("_", ","), ContentType = "IMAGEURLSUB", HAlign = Master.Master.GetAlignmentNumber(parentISU.HAlign), VAlign = Master.Master.GetAlignmentNumber(parentISU.VAlign), Height = objImgSubUrl.Height }; break; case "IMAGESUBBYTE": var objImgSubByte = contM.Properties as ImageSubByteCellGridClass; var parentISB = (tNode.Parent.Tag as ControlPropertyModel).Properties as CellGridCalss; cell = new ImageByteSubHeaderCell { ImageFieldName = objImgSubByte.Name, ModelName = objImgSubByte.ImageFieldModel, Scale = objImgSubByte.Scale, ColSpan = parentISB.ColSpan, RowSpan = parentISB.RowSpan, PTop = parentISB.PTop, PBottom = parentISB.PBottom, PLeft = parentISB.PLeft, PRight = parentISB.PRight, BorderPattren = parentISB.BorderPattren.ToString().Replace("_", ","), ContentType = "IMAGEBYTESUB", HAlign = Master.Master.GetAlignmentNumber(parentISB.HAlign), VAlign = Master.Master.GetAlignmentNumber(parentISB.VAlign), Height = objImgSubByte.Height }; break; } } catch (Exception ex) { } return(cell); }