internal SLComment Clone() { var comm = new SLComment(listThemeColors); comm.sAuthor = sAuthor; comm.rst = rst.Clone(); comm.HasSetPosition = HasSetPosition; comm.Top = Top; comm.Left = Left; comm.UsePositionMargin = UsePositionMargin; comm.TopMargin = TopMargin; comm.LeftMargin = LeftMargin; comm.AutoSize = AutoSize; comm.fWidth = fWidth; comm.fHeight = fHeight; comm.Fill = Fill.Clone(); comm.bFromTransparency = bFromTransparency; comm.bToTransparency = bToTransparency; comm.LineColor = LineColor; comm.fLineWeight = fLineWeight; comm.LineStyle = LineStyle; comm.vLineDashStyle = vLineDashStyle; comm.vEndCap = vEndCap; comm.HorizontalTextAlignment = HorizontalTextAlignment; comm.VerticalTextAlignment = VerticalTextAlignment; comm.Orientation = Orientation; comm.TextDirection = TextDirection; comm.HasShadow = HasShadow; comm.ShadowColor = ShadowColor; comm.Visible = Visible; return(comm); }
/// <summary> /// Set custom label text. /// </summary> /// <param name="Text">The custom text.</param> public void SetLabelText(string Text) { SLRstType rst = new SLRstType(); rst.AppendText(Text); this.RichText = rst.Clone(); }
/// <summary> /// Get existing shared strings. WARNING: This is only a snapshot. Any changes made to the returned result are not /// used. /// </summary> /// <returns>A list of existing shared strings.</returns> public List <SLRstType> GetSharedStrings() { var result = new List <SLRstType>(); var rst = new SLRstType(); for (var i = 0; i < listSharedString.Count; ++i) { rst.FromHash(listSharedString[i]); result.Add(rst.Clone()); } return(result); }
/// <summary> /// Get existing comments in the currently selected worksheet. WARNING: This is only a snapshot. Any changes made to /// the returned result are not used. /// </summary> /// <returns>A Dictionary of existing comments.</returns> public Dictionary <SLCellPoint, SLRstType> GetCommentText() { var result = new Dictionary <SLCellPoint, SLRstType>(); // we don't add to existing comments, so it's either get existing comments // or use the newly inserted comments. if (!string.IsNullOrEmpty(gsSelectedWorksheetRelationshipID)) { var wsp = (WorksheetPart)wbp.GetPartById(gsSelectedWorksheetRelationshipID); if (wsp.WorksheetCommentsPart != null) { Comment comm; int iRowIndex, iColumnIndex; var rst = new SLRstType(); using (var oxr = OpenXmlReader.Create(wsp.WorksheetCommentsPart.Comments.CommentList)) { while (oxr.Read()) { if (oxr.ElementType == typeof(Comment)) { comm = (Comment)oxr.LoadCurrentElement(); SLTool.FormatCellReferenceToRowColumnIndex(comm.Reference.Value, out iRowIndex, out iColumnIndex); rst.FromCommentText(comm.CommentText); result[new SLCellPoint(iRowIndex, iColumnIndex)] = rst.Clone(); } } } } else { var pts = slws.Comments.Keys.ToList(); foreach (var pt in pts) { result[pt] = slws.Comments[pt].rst.Clone(); } } } return(result); }
/// <summary> /// Set the title with a rich text string. /// </summary> /// <param name="RichText">The rich text.</param> public void SetTitle(SLRstType RichText) { this.rst = RichText.Clone(); }
/// <summary> /// Set custom label text. /// </summary> /// <param name="RichText">The custom text in rich text format.</param> public void SetLabelText(SLRstType RichText) { this.RichText = RichText.Clone(); }
/// <summary> /// Set the comment text given rich text content. /// </summary> /// <param name="RichText">The rich text content</param> public void SetText(SLRstType RichText) { rst = new SLRstType(); rst = RichText.Clone(); }