Esempio n. 1
0
 public PictureInfo(int minRow, int maxRow, int minCol, int maxCol, Byte[] pictureData, PictureStyle pictureStyle)
 {
     MinRow = minRow;
     MaxRow = maxRow;
     MinCol = minCol;
     MaxCol = maxCol;
     PictureData = pictureData;
     PicturesStyle = pictureStyle;
 }
Esempio n. 2
0
 public PictureInfo(int minRow, int maxRow, int minCol, int maxCol, Byte[] pictureData, PictureStyle pictureStyle)
 {
     this.MinRow = minRow;
     this.MaxRow = maxRow;
     this.MinCol = minCol;
     this.MaxCol = maxCol;
     this.PictureData = pictureData;
     this.PicturesStyle = pictureStyle;
 }
Esempio n. 3
0
 public PictureInfo(int minRow, int maxRow, int minCol, int maxCol, Byte[] pictureData, PictureStyle pictureStyle)
 {
     MinRow        = minRow;
     MaxRow        = maxRow;
     MinCol        = minCol;
     MaxCol        = maxCol;
     PictureData   = pictureData;
     PicturesStyle = pictureStyle;
 }
Esempio n. 4
0
        /// <summary>
        ///     XSSFSheet获取指定区域包含图片的信息列表
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="minRow"></param>
        /// <param name="maxRow"></param>
        /// <param name="minCol"></param>
        /// <param name="maxCol"></param>
        /// <param name="onlyInternal"></param>
        /// <returns></returns>
        private static List <PictureInfo> GetAllPictureInfos(XSSFSheet sheet, int?minRow, int?maxRow, int?minCol,
                                                             int?maxCol, bool onlyInternal)
        {
            var picturesInfoList = new List <PictureInfo>();

            List <POIXMLDocumentPart> documentPartList = sheet.GetRelations();

            foreach (POIXMLDocumentPart documentPart in documentPartList)
            {
                if (documentPart is XSSFDrawing)
                {
                    var drawing = (XSSFDrawing)documentPart;
                    List <XSSFShape> shapeList = drawing.GetShapes();
                    foreach (XSSFShape shape in shapeList)
                    {
                        if (shape is XSSFPicture)
                        {
                            var           picture = (XSSFPicture)shape;
                            IClientAnchor anchor  = picture.GetPreferredSize();

                            if (IsInternalOrIntersect(minRow, maxRow, minCol, maxCol, anchor.Row1, anchor.Row2,
                                                      anchor.Col1, anchor.Col2, onlyInternal))
                            {
                                var picStyle = new PictureStyle
                                {
                                    AnchorDx1      = anchor.Dx1,
                                    AnchorDx2      = anchor.Dx2,
                                    AnchorDy1      = anchor.Dy1,
                                    AnchorDy2      = anchor.Dy2,
                                    IsNoFill       = picture.IsNoFill,
                                    LineStyle      = picture.LineStyle,
                                    LineStyleColor = picture.LineStyleColor,
                                    LineWidth      = picture.LineWidth,
                                    FillColor      = picture.FillColor
                                };
                                picturesInfoList.Add(new PictureInfo(anchor.Row1, anchor.Row2, anchor.Col1, anchor.Col2,
                                                                     picture.PictureData.Data, picStyle));
                            }
                        }
                    }
                }
            }

            return(picturesInfoList);
        }
Esempio n. 5
0
        /// <summary>
        ///     HSSFSheet获取指定区域包含图片的信息列表
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="minRow"></param>
        /// <param name="maxRow"></param>
        /// <param name="minCol"></param>
        /// <param name="maxCol"></param>
        /// <param name="onlyInternal"></param>
        /// <returns></returns>
        private static List <PictureInfo> GetAllPictureInfos(HSSFSheet sheet, int?minRow, int?maxRow, int?minCol,
                                                             int?maxCol, bool onlyInternal)
        {
            var picturesInfoList = new List <PictureInfo>();

            var shapeContainer = sheet.DrawingPatriarch as HSSFShapeContainer;

            if (null != shapeContainer)
            {
                IList <HSSFShape> shapeList = shapeContainer.Children;
                foreach (HSSFShape shape in shapeList)
                {
                    if (shape is HSSFPicture && shape.Anchor is HSSFClientAnchor)
                    {
                        var picture = (HSSFPicture)shape;
                        var anchor  = (HSSFClientAnchor)shape.Anchor;
                        if (IsInternalOrIntersect(minRow, maxRow, minCol, maxCol, anchor.Row1, anchor.Row2, anchor.Col1,
                                                  anchor.Col2, onlyInternal))
                        {
                            var picStyle = new PictureStyle
                            {
                                AnchorDx1      = anchor.Dx1,
                                AnchorDx2      = anchor.Dx2,
                                AnchorDy1      = anchor.Dy1,
                                AnchorDy2      = anchor.Dy2,
                                IsNoFill       = picture.IsNoFill,
                                LineStyle      = picture.LineStyle,
                                LineStyleColor = picture.LineStyleColor,
                                LineWidth      = picture.LineWidth,
                                FillColor      = picture.FillColor
                            };
                            picturesInfoList.Add(new PictureInfo(anchor.Row1, anchor.Row2, anchor.Col1, anchor.Col2,
                                                                 picture.PictureData.Data, picStyle));
                        }
                    }
                }
            }

            return(picturesInfoList);
        }
Esempio n. 6
0
        /// <summary>
        /// XSSFSheet获取指定区域包含图片的信息列表
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="minRow"></param>
        /// <param name="maxRow"></param>
        /// <param name="minCol"></param>
        /// <param name="maxCol"></param>
        /// <param name="onlyInternal"></param>
        /// <returns></returns>
        private static List<PictureInfo> GetAllPictureInfos(XSSFSheet sheet, int? minRow, int? maxRow, int? minCol, int? maxCol, bool onlyInternal)
        {
            List<PictureInfo> picturesInfoList = new List<PictureInfo>();

            var documentPartList = sheet.GetRelations();
            foreach (var documentPart in documentPartList)
            {
                if (documentPart is XSSFDrawing)
                {
                    var drawing = (XSSFDrawing)documentPart;
                    var shapeList = drawing.GetShapes();
                    foreach (var shape in shapeList)
                    {
                        if (shape is XSSFPicture)
                        {
                            var picture = (XSSFPicture)shape;
                            var anchor = picture.GetPreferredSize();

                            if (IsInternalOrIntersect(minRow, maxRow, minCol, maxCol, anchor.Row1, anchor.Row2, anchor.Col1, anchor.Col2, onlyInternal))
                            {
                                var picStyle = new PictureStyle
                                {
                                    AnchorDx1 = anchor.Dx1,
                                    AnchorDx2 = anchor.Dx2,
                                    AnchorDy1 = anchor.Dy1,
                                    AnchorDy2 = anchor.Dy2,
                                    IsNoFill = picture.IsNoFill,
                                    LineStyle = picture.LineStyle,
                                    LineStyleColor = picture.LineStyleColor,
                                    LineWidth = picture.LineWidth,
                                    FillColor = picture.FillColor
                                };
                                picturesInfoList.Add(new PictureInfo(anchor.Row1, anchor.Row2, anchor.Col1, anchor.Col2, picture.PictureData.Data, picStyle));
                            }
                        }
                    }
                }
            }

            return picturesInfoList;
        }
Esempio n. 7
0
        /// <summary>
        /// HSSFSheet获取指定区域包含图片的信息列表
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="minRow"></param>
        /// <param name="maxRow"></param>
        /// <param name="minCol"></param>
        /// <param name="maxCol"></param>
        /// <param name="onlyInternal"></param>
        /// <returns></returns>
        private static List<PictureInfo> GetAllPictureInfos(HSSFSheet sheet, int? minRow, int? maxRow, int? minCol, int? maxCol, bool onlyInternal)
        {
            List<PictureInfo> picturesInfoList = new List<PictureInfo>();

            var shapeContainer = sheet.DrawingPatriarch as HSSFShapeContainer;
            if (null != shapeContainer)
            {
                var shapeList = shapeContainer.Children;
                foreach (var shape in shapeList)
                {
                    if (shape is HSSFPicture && shape.Anchor is HSSFClientAnchor)
                    {
                        var picture = (HSSFPicture)shape;
                        var anchor = (HSSFClientAnchor)shape.Anchor;
                        if (IsInternalOrIntersect(minRow, maxRow, minCol, maxCol, anchor.Row1, anchor.Row2, anchor.Col1, anchor.Col2, onlyInternal))
                        {
                            var picStyle = new PictureStyle
                            {
                                AnchorDx1 = anchor.Dx1,
                                AnchorDx2 = anchor.Dx2,
                                AnchorDy1 = anchor.Dy1,
                                AnchorDy2 = anchor.Dy2,
                                IsNoFill = picture.IsNoFill,
                                LineStyle = picture.LineStyle,
                                LineStyleColor = picture.LineStyleColor,
                                LineWidth = picture.LineWidth,
                                FillColor = picture.FillColor
                            };
                            picturesInfoList.Add(new PictureInfo(anchor.Row1, anchor.Row2, anchor.Col1, anchor.Col2, picture.PictureData.Data, picStyle));
                        }
                    }
                }
            }

            return picturesInfoList;
        }