Example #1
0
        /**
         * Create and Initialize a CT_TwoCellAnchor that anchors a shape against top-left and bottom-right cells.
         *
         * @return a new CT_TwoCellAnchor
         */
        private CT_TwoCellAnchor CreateTwoCellAnchor(IClientAnchor anchor)
        {
            CT_TwoCellAnchor ctAnchor   = drawing.AddNewTwoCellAnchor();
            XSSFClientAnchor xssfanchor = (XSSFClientAnchor)anchor;

            ctAnchor.from = (xssfanchor.From);
            ctAnchor.to   = (xssfanchor.To);
            ctAnchor.AddNewClientData();
            xssfanchor.To   = ctAnchor.to;
            xssfanchor.From = ctAnchor.from;
            ST_EditAs aditAs;

            switch (anchor.AnchorType)
            {
            case AnchorType.DontMoveAndResize:
                aditAs = ST_EditAs.absolute; break;

            case AnchorType.MoveAndResize:
                aditAs = ST_EditAs.twoCell; break;

            case AnchorType.MoveDontResize:
                aditAs = ST_EditAs.oneCell; break;

            default:
                aditAs = ST_EditAs.oneCell;
                break;
            }
            ctAnchor.editAs          = aditAs;
            ctAnchor.editAsSpecified = true;
            return(ctAnchor);
        }
Example #2
0
        /**
         * Create and Initialize a CT_TwoCellAnchor that anchors a shape against top-left and bottom-right cells.
         *
         * @return a new CT_TwoCellAnchor
         */
        private CT_TwoCellAnchor CreateTwoCellAnchor(IClientAnchor anchor)
        {
            CT_TwoCellAnchor ctAnchor   = drawing.AddNewTwoCellAnchor();
            XSSFClientAnchor xssfanchor = (XSSFClientAnchor)anchor;

            ctAnchor.from = (xssfanchor.GetFrom());
            ctAnchor.to   = (xssfanchor.GetTo());
            ctAnchor.AddNewClientData();
            xssfanchor.SetTo(ctAnchor.to);
            xssfanchor.SetFrom(ctAnchor.from);
            ST_EditAs aditAs;

            switch (anchor.AnchorType)
            {
            case (int)AnchorType.DONT_MOVE_AND_RESIZE:
                aditAs = ST_EditAs.absolute; break;

            case (int)AnchorType.MOVE_AND_RESIZE:
                aditAs = ST_EditAs.twoCell; break;

            case (int)AnchorType.MOVE_DONT_RESIZE:
                aditAs = ST_EditAs.oneCell; break;

            default:
                aditAs = ST_EditAs.oneCell;
                break;
            }
            ctAnchor.editAs          = aditAs;
            ctAnchor.editAsSpecified = true;
            return(ctAnchor);
        }