コード例 #1
0
ファイル: XSSFPicture.cs プロジェクト: thachgiasoft/shuijin
 internal static CT_Picture Prototype()
 {
     if (XSSFPicture.prototype == null)
     {
         CT_Picture               ctPicture          = new CT_Picture();
         CT_PictureNonVisual      pictureNonVisual   = ctPicture.AddNewNvPicPr();
         CT_NonVisualDrawingProps visualDrawingProps = pictureNonVisual.AddNewCNvPr();
         visualDrawingProps.id    = 1U;
         visualDrawingProps.name  = "Picture 1";
         visualDrawingProps.descr = "Picture";
         pictureNonVisual.AddNewCNvPicPr().AddNewPicLocks().noChangeAspect = true;
         CT_BlipFillProperties blipFillProperties = ctPicture.AddNewBlipFill();
         blipFillProperties.AddNewBlip().embed    = "";
         blipFillProperties.AddNewStretch().AddNewFillRect();
         CT_ShapeProperties ctShapeProperties = ctPicture.AddNewSpPr();
         CT_Transform2D     ctTransform2D     = ctShapeProperties.AddNewXfrm();
         CT_PositiveSize2D  ctPositiveSize2D  = ctTransform2D.AddNewExt();
         ctPositiveSize2D.cx = 0L;
         ctPositiveSize2D.cy = 0L;
         CT_Point2D ctPoint2D = ctTransform2D.AddNewOff();
         ctPoint2D.x = 0L;
         ctPoint2D.y = 0L;
         CT_PresetGeometry2D presetGeometry2D = ctShapeProperties.AddNewPrstGeom();
         presetGeometry2D.prst = ST_ShapeType.rect;
         presetGeometry2D.AddNewAvLst();
         XSSFPicture.prototype = ctPicture;
     }
     return(XSSFPicture.prototype);
 }
コード例 #2
0
        internal static CT_Picture Prototype()
        {
            CT_Picture          pic  = new CT_Picture();
            CT_PictureNonVisual nvpr = pic.AddNewNvPicPr();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualDrawingProps nvProps = nvpr.AddNewCNvPr();
            nvProps.id    = (1);
            nvProps.name  = ("Picture 1");
            nvProps.descr = ("Picture");
            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_NonVisualPictureProperties nvPicProps = nvpr.AddNewCNvPicPr();
            nvPicProps.AddNewPicLocks().noChangeAspect = true;



            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_BlipFillProperties blip = pic.AddNewBlipFill();
            blip.AddNewBlip().embed = "";
            blip.AddNewStretch().AddNewFillRect();

            NPOI.OpenXmlFormats.Dml.Spreadsheet.CT_ShapeProperties sppr = pic.AddNewSpPr();
            CT_Transform2D    t2d = sppr.AddNewXfrm();
            CT_PositiveSize2D ext = t2d.AddNewExt();

            //should be original picture width and height expressed in EMUs
            ext.cx = (0);
            ext.cy = (0);

            CT_Point2D off = t2d.AddNewOff();

            off.x = (0);
            off.y = (0);

            CT_PresetGeometry2D prstGeom = sppr.AddNewPrstGeom();

            prstGeom.prst = (ST_ShapeType.rect);
            prstGeom.AddNewAvLst();

            prototype = pic;
            return(prototype);
        }