Esempio n. 1
0
        /// <summary>
        /// CreateFromData
        /// </summary>
        internal TNoteRecord(int aRow, int aCol, TRichString aTxt, string aAuthor, TDrawing Drawing, TImageProperties Properties,
                             ExcelFile xls, TSheet sSheet, bool ReadFromXlsx)
            : base((int)xlr.NOTE, aCol)
        {
            if ((aCol < 0) || (aCol > FlxConsts.Max_Columns))
            {
                XlsMessages.ThrowException(XlsErr.ErrXlsIndexOutBounds, aCol, "Column", 0, FlxConsts.Max_Columns);
            }

            Dwg = Drawing.AddNewComment(xls, Properties, sSheet, ReadFromXlsx);
            TEscherImageAnchorRecord Anchor = GetImageRecord();

            if (Anchor != null)
            {
                NoteTextBox = Anchor.SaveCommentCoords(sSheet, aRow, aCol);
            }

            Col         = aCol;
            OptionFlags = 0;   //option flags
            unchecked
            {
                ObjId = (UInt16)Dwg.ObjId;   //object id
            }

            Author = aAuthor;

            SetText(aTxt);
        }
Esempio n. 2
0
/*Now we keep range to insert on dwgofs. Inserting here could lead to inserting rows on the cells (and moving the red triangle down), but not on the note. Both must move together.
 *         internal override void ArrangeInsertRange(int Row, TXlsCellRange CellRange, int aRowCount, int aColCount, TSheetInfo SheetInfo)
 *      {
 *          if ((SheetInfo.InsSheet<0) || (SheetInfo.SourceFormulaSheet != SheetInfo.InsSheet)) return;  //this is also on the base.arrangeinsertrange, but we want to keep both inserts together. If we insert on the red triangle, we insert on the shape. If we don't we don't no matter that the shape is on range to insert.
 *
 *          base.ArrangeInsertRange (Row, CellRange, aRowCount, aColCount, SheetInfo);
 *          if ((Dwg!=null) && (Dwg.FindRoot()!=null))
 *          {
 *              Dwg.FindRoot().ArrangeInsertRange(CellRange, aRowCount, aColCount, SheetInfo, true);
 *          }
 *      }
 */
        internal void FixDwgIds(TDrawing Drawing, int Row, TSheet sSheet, bool UseObjId, TCopiedGen CopiedGen)
        {
            if (UseObjId)
            {
                Dwg = Drawing.FindObjId(ObjId);
            }
            else
            {
                if (Dwg != null)
                {
                    Dwg = Dwg.CopiedTo(CopiedGen) as TEscherClientDataRecord;
                }
                if (Dwg != null)
                {
                    ObjId = (UInt16)Dwg.ObjId;
                }
            }
            TEscherImageAnchorRecord Anchor = GetImageRecord();

            if (Anchor != null)
            {
                NoteTextBox = Anchor.SaveCommentCoords(sSheet, Row, Col);
            }
        }