Exemplo n.º 1
0
        public void View3dSceneRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "View3DScene");

            //Assert
            Assert.AreEqual(ePresetCameraType.ObliqueTopLeft, shape.ThreeD.Scene.Camera.CameraType);
            Assert.AreEqual(90, shape.ThreeD.Scene.Camera.Zoom);
            Assert.AreEqual(100, shape.ThreeD.Scene.Camera.Rotation.Latitude);
            Assert.AreEqual(200, shape.ThreeD.Scene.Camera.Rotation.Longitude);
            Assert.AreEqual(300, shape.ThreeD.Scene.Camera.Rotation.Revolution);
            Assert.AreEqual(eRigPresetType.Sunset, shape.ThreeD.Scene.LightRig.RigType);
            Assert.AreEqual(eLightRigDirection.BottomRight, shape.ThreeD.Scene.LightRig.Direction);


            Assert.AreEqual(ePresetMaterialType.LegacyWireframe, shape.ThreeD.MaterialType);

            Assert.AreEqual(eBevelPresetType.Circle, shape.ThreeD.TopBevel.BevelType);
            Assert.AreEqual(8, shape.ThreeD.TopBevel.Width);
            Assert.AreEqual(6, shape.ThreeD.TopBevel.Height);

            Assert.AreEqual(eBevelPresetType.Divot, shape.ThreeD.BottomBevel.BevelType);
            Assert.AreEqual(6, shape.ThreeD.BottomBevel.Width);
            Assert.AreEqual(4, shape.ThreeD.BottomBevel.Height);

            Assert.AreEqual(eDrawingColorType.Hsl, shape.ThreeD.ContourColor.ColorType);
            Assert.AreEqual(90, shape.ThreeD.ContourColor.HslColor.Hue);
            Assert.AreEqual(4, shape.ThreeD.ContourWidth);
            Assert.AreEqual(eDrawingColorType.Preset, shape.ThreeD.ExtrusionColor.ColorType);
            Assert.AreEqual(ePresetColor.Azure, shape.ThreeD.ExtrusionColor.PresetColor.Color);
            Assert.AreEqual(11, shape.ThreeD.ExtrusionHeight);
        }
Exemplo n.º 2
0
 public OfficeOpenShapeWriter(ExcelShape shape, ExcelWorksheet worksheet)
 {
     Shape     = shape;
     XmlWriter = new XmlDrawingHelper {
         XmlDocument = worksheet.Drawings.DrawingXml
     };
 }
Exemplo n.º 3
0
        private void HandleAndPrintData(ExcelShape shape, ExcelShape shapeValues, string key, string text, int maxLength,
                                        bool isAddNewLine)
        {
            var words       = text.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            var line        = string.Empty;
            var isFirstLine = true;

            foreach (var word in words)
            {
                if (GetSizeOfText(line + word, _parameterFontNormal).Width > maxLength)
                {
                    var keyData = isFirstLine ? key : " ";
                    PrintData(shape, keyData, _parameterFontBold, true);
                    PrintData(shapeValues, line, _parameterFontNormal, true);
                    line        = word + " ";
                    isFirstLine = false;
                }
                else
                {
                    line += word + " ";
                }
            }
            if (!string.IsNullOrEmpty(line))
            {
                var keyData = isFirstLine ? key : " ";
                PrintData(shape, keyData, _parameterFontBold, isAddNewLine);
                PrintData(shapeValues, line, _parameterFontNormal, isAddNewLine);
            }
        }
Exemplo n.º 4
0
        public void Scene3dDefaultLightRigDirRead()
        {
            ExcelShape shape = TryGetShape(_pck, "Scene3DLightRig");

            //Assert
            Assert.AreEqual(shape.ThreeD.Scene.LightRig.Direction, eLightRigDirection.Top);
        }
Exemplo n.º 5
0
        public void Scene3dDefaultLightRigTypeRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "Scene3DLightRigType");

            //Assert
            Assert.AreEqual(shape.ThreeD.Scene.LightRig.RigType, eRigPresetType.Soft);
        }
Exemplo n.º 6
0
        public void Scene3dDefaultLightBackplanReade()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "Scene3DBackplane");

            //Assert
            Assert.AreEqual(3, shape.ThreeD.Scene.BackDropPlane.AnchorPoint.X);
        }
Exemplo n.º 7
0
        public void View3dMaterialTypeDefaultRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "View3DMaterialTypeDefault");

            //Assert
            Assert.AreEqual(ePresetMaterialType.Plastic, shape.ThreeD.MaterialType);
        }
Exemplo n.º 8
0
        public void Scene3dDefaultCameraRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "Scene3DDefaultCamera");

            //Assert
            Assert.AreEqual(ePresetCameraType.IsometricOffAxis1Left, shape.ThreeD.Scene.Camera.CameraType);
            Assert.AreEqual(eRigPresetType.ThreePt, shape.ThreeD.Scene.LightRig.RigType);
            Assert.AreEqual(eLightRigDirection.Top, shape.ThreeD.Scene.LightRig.Direction);
        }
Exemplo n.º 9
0
        public void View3dExtrusionColorDefaultRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "View3DExtrusionColorDefault");

            //Assert
            Assert.AreEqual(eDrawingColorType.Scheme, shape.ThreeD.ExtrusionColor.ColorType);
            Assert.AreEqual(eSchemeColor.Background1, shape.ThreeD.ExtrusionColor.SchemeColor.Color);
            Assert.AreEqual(1, shape.ThreeD.ExtrusionHeight);
        }
Exemplo n.º 10
0
        public void View3dBevelBDefaultRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "View3DBevelBDefault");

            //Assert
            Assert.AreEqual(6, shape.ThreeD.BottomBevel.Width);
            Assert.AreEqual(6, shape.ThreeD.BottomBevel.Height);
            Assert.AreEqual(eBevelPresetType.Circle, shape.ThreeD.BottomBevel.BevelType);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Adds the custom shape.
        /// </summary>
        /// <param name="ws">Worksheet</param>
        /// <param name="colIndex">Column Index</param>
        /// <param name="rowIndex">Row Index</param>
        /// <param name="shapeStyle">Shape style</param>
        /// <param name="text">Text for the shape</param>
        private static void AddCustomShape(ExcelWorksheet ws, int colIndex, int rowIndex, eShapeStyle shapeStyle, string text)
        {
            ExcelShape shape = ws.Drawings.AddShape("cs" + rowIndex.ToString() + colIndex.ToString(), shapeStyle);

            shape.From.Column    = colIndex;
            shape.From.Row       = rowIndex;
            shape.From.ColumnOff = Pixel2MTU(5);
            shape.SetSize(100, 100);
            shape.RichText.Add(text);
        }
Exemplo n.º 12
0
        public void View3dContourColorDefaultRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "View3DContourColorDefault");

            //Assert
            Assert.AreEqual(eDrawingColorType.Scheme, shape.ThreeD.ContourColor.ColorType);
            Assert.AreEqual(eSchemeColor.Accent6, shape.ThreeD.ContourColor.SchemeColor.Color);
            Assert.AreEqual(1, shape.ThreeD.ContourWidth);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Addre Custom Shape with text to WorkSheet
        /// </summary>
        /// <param name="excelWorksheet"></param>
        /// <param name="colIndex"></param>
        /// <param name="rowIndex"></param>
        /// <param name="shapeStyle">eShapeStyle</param>
        /// <param name="text">Shape Content inside</param>
        /// <param name="shapeSize">Size of Shape</param>
        /// <returns></returns>
        public ExcelWorksheet AddCustomShape(ExcelWorksheet excelWorksheet, int colIndex, int rowIndex, eShapeStyle shapeStyle, string text, Size shapeSize)
        {
            ExcelShape shape = excelWorksheet.Drawings.AddShape("cs" + rowIndex.ToString() + colIndex.ToString(), shapeStyle);

            shape.From.Column    = colIndex;
            shape.From.Row       = rowIndex;
            shape.From.ColumnOff = Pixel2MTU(5);
            shape.SetSize(shapeSize.Width, shapeSize.Height);
            shape.RichText.Add(text);
            return(excelWorksheet);
        }
Exemplo n.º 14
0
        public static ExcelShape AddShape(this ExcelWorksheet sheet, string name)
        {
            ExcelShape es = sheet.Drawings.AddShape(name, eShapeStyle.Rect);

            es.Border.LineStyle  = eLineStyle.Solid;
            es.Border.Width      = 1.5;
            es.Border.Fill.Color = Color.Red;
            es.Fill.Style        = eFillStyle.NoFill;

            return(es);
        }
Exemplo n.º 15
0
        private static void PrintData(ExcelShape shape, string data, Font font, bool isAddNewLine)
        {
            var title = shape.RichText.Add(data);

            title.LatinFont = font.OriginalFontName;
            title.Size      = font.Size;
            title.Bold      = font.Bold;
            if (isAddNewLine)
            {
                shape.RichText.Add(Environment.NewLine);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Adding custom shape or object in specifed cell of specified excel sheet
        /// </summary>
        /// <param name="oSheet">The ExcelWorksheet object</param>
        /// <param name="rowIndex">The row number of the cell where the object will put</param>
        /// <param name="colIndex">The column number of the cell where the object will put</param>
        /// <param name="shapeStyle">The style of the shape of the object</param>
        /// <param name="text">Text inside the object</param>
        private void AddCustomObject(ExcelWorksheet oSheet, int rowIndex, int colIndex, eShapeStyle shapeStyle, string text)
        {
            ExcelShape excelShape = oSheet.Drawings.AddShape("Custom Object", shapeStyle);

            excelShape.From.Column = colIndex;
            excelShape.From.Row    = rowIndex;
            excelShape.SetSize(100, 100);
            // 5x5 px space for better alignment
            excelShape.From.RowOff    = Pixel2MTU(5);
            excelShape.From.ColumnOff = Pixel2MTU(5);
            // Adding text into the shape
            excelShape.RichText.Add(text);
        }
Exemplo n.º 17
0
        private static void SetStyleForShape(Font font, ExcelShape shape)
        {
            shape.Fill.Style = eFillStyle.SolidFill;
            shape.Fill.Color = Color.White;

            shape.Border.Fill.Style    = eFillStyle.NoFill;
            shape.TextAnchoring        = eTextAnchoringType.Top;
            shape.TextVertical         = eTextVerticalType.Horizontal;
            shape.TextAnchoringControl = false;
            shape.Font.Color           = Color.Black;
            shape.Font.LatinFont       = font.OriginalFontName;
            shape.Font.Bold            = font.Bold;
            shape.Font.Size            = font.Size;
        }
Exemplo n.º 18
0
        public void View3dNosp3dRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "View3DNosp3d");

            //Assert
            Assert.AreEqual(ePresetCameraType.IsometricLeftDown, shape.ThreeD.Scene.Camera.CameraType);
            Assert.AreEqual(80, shape.ThreeD.Scene.Camera.Zoom);
            Assert.AreEqual(5, shape.ThreeD.Scene.Camera.Rotation.Latitude);
            Assert.AreEqual(10, shape.ThreeD.Scene.Camera.Rotation.Longitude);
            Assert.AreEqual(20, shape.ThreeD.Scene.Camera.Rotation.Revolution);
            Assert.AreEqual(eRigPresetType.LegacyNormal3, shape.ThreeD.Scene.LightRig.RigType);
            Assert.AreEqual(eLightRigDirection.TopLeft, shape.ThreeD.Scene.LightRig.Direction);
        }
Exemplo n.º 19
0
        private static void FormatShape(ExcelShape shape, CellsAppearance appearance)
        {
            if (appearance.UseFillColor)
            {
                shape.Fill.Color = appearance.FillColor;
            }
            else
            {
                shape.Fill.Color        = Color.Transparent;
                shape.Fill.Transparancy = 100;
            }

            shape.Border.Width      = appearance.StrokeWidth;
            shape.Border.Fill.Color = appearance.StrokeColor;
        }
        private static void FormatCaption(ExcelShape captionShape, CellsAppearance appearance)
        {
            captionShape.Fill.Transparancy = 30;

            captionShape.TextAlignment = appearance.TextAlignment;
            captionShape.TextAnchoring = appearance.TextVerticalAlignment;

            AppearanceHelper.SetFromFont(captionShape.Font.SetFromFont, appearance.FontFamily, appearance.FontSize);
            captionShape.Font.Color = appearance.TextColor;
            captionShape.Font.Size  = appearance.FontSize;

            captionShape.Font.Bold      = appearance.Bold;
            captionShape.Font.Italic    = appearance.Italic;
            captionShape.Font.UnderLine = appearance.Underline ? eUnderLineType.Single : eUnderLineType.None;

            captionShape.Fill.Color        = appearance.BackgroundColor;
            captionShape.Border.Fill.Color = appearance.CellBorderColor;
        }
Exemplo n.º 21
0
        public void View3dNoSceneRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "View3DNoScene");

            //Assert
            Assert.AreEqual(ePresetMaterialType.Metal, shape.ThreeD.MaterialType);

            Assert.AreEqual(eBevelPresetType.Slope, shape.ThreeD.TopBevel.BevelType);
            Assert.AreEqual(6, shape.ThreeD.TopBevel.Width);
            Assert.AreEqual(7, shape.ThreeD.TopBevel.Height);

            Assert.AreEqual(eBevelPresetType.ArtDeco, shape.ThreeD.BottomBevel.BevelType);
            Assert.AreEqual(5, shape.ThreeD.BottomBevel.Width);
            Assert.AreEqual(6, shape.ThreeD.BottomBevel.Height);

            Assert.AreEqual(eDrawingColorType.Scheme, shape.ThreeD.ContourColor.ColorType);
            Assert.AreEqual(eSchemeColor.Accent4, shape.ThreeD.ContourColor.SchemeColor.Color);
            Assert.AreEqual(5, shape.ThreeD.ContourWidth);
            Assert.AreEqual(eDrawingColorType.System, shape.ThreeD.ExtrusionColor.ColorType);
            Assert.AreEqual(eSystemColor.Background, shape.ThreeD.ExtrusionColor.SystemColor.Color);
            Assert.AreEqual(8, shape.ThreeD.ExtrusionHeight);
        }
Exemplo n.º 22
0
        public void Scene3dThreeDRead()
        {
            //Setup
            ExcelShape shape = TryGetShape(_pck, "ThreeDTest");

            //Act
            shape.ThreeD.Scene.Camera.CameraType            = ePresetCameraType.IsometricBottomDown;
            shape.ThreeD.Scene.LightRig.Direction           = eLightRigDirection.Top;
            shape.ThreeD.Scene.LightRig.RigType             = eRigPresetType.Sunset;
            shape.ThreeD.Scene.LightRig.Rotation.Revolution = 60;

            shape.ThreeD.MaterialType          = ePresetMaterialType.DkEdge;
            shape.ThreeD.ContourWidth          = 1;
            shape.ThreeD.ExtrusionHeight       = 6;
            shape.ThreeD.ShapeDepthZCoordinate = 1;
            shape.ThreeD.TopBevel.Width        = 0;
            shape.ThreeD.BottomBevel.BevelType = eBevelPresetType.RelaxedInset;
            shape.ThreeD.ExtrusionColor.SetSchemeColor(eSchemeColor.Background2);
            shape.ThreeD.ExtrusionColor.Transforms.AddLuminanceModulation(90);
            shape.ThreeD.ContourColor.SetSchemeColor(eSchemeColor.Accent1);
            shape.ThreeD.ContourColor.Transforms.AddLuminanceModulation(75);
            //Assert
        }
Exemplo n.º 23
0
        private static void SetExcelStyle(ExcelPackage package)
        {
            ExcelWorksheet sheet = package.Workbook.Worksheets.Add("test");

            sheet.Cells[1, 1].Value = "Project Name";
            sheet.Cells[1, 2].Value = "Project Price";
            sheet.Cells[1, 3].Value = "Sale Percent";

            sheet.Cells[2, 1].Value      = "Rice";
            sheet.Cells[2, 2].Value      = 65;
            sheet.Cells[2, 3].Value      = 100;
            sheet.Cells["D2:D2"].Formula = "B2*C2";

            sheet.Cells[3, 1].Value      = "玉米";
            sheet.Cells[3, 2].Value      = 45;
            sheet.Cells[3, 3].Value      = 150;
            sheet.Cells["D3:D3"].Formula = "B3*C3";

            sheet.Cells[4, 1].Value      = "小米";
            sheet.Cells[4, 2].Value      = 38;
            sheet.Cells[4, 3].Value      = 130;
            sheet.Cells["D4:D4"].Formula = "B4*C4";

            sheet.Cells[5, 1].Value      = "糯米";
            sheet.Cells[5, 2].Value      = 22;
            sheet.Cells[5, 3].Value      = 200;
            sheet.Cells["D5:D5"].Formula = "B5*C5";

            // auto sum
            //sheet.Cells[6, 2, 6, 4].Formula = string.Format("SUBTOTAL(9,{0})", new ExcelAddress(2, 2, 5, 2).Address);
            // set cell formula, and keep two decimals.
            sheet.Cells[5, 3].Style.Numberformat.Format = "#,##0.00";
            sheet.Cells[1, 1].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            sheet.Cells[1, 1].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            sheet.Cells[1, 4, 1, 5].Merge = true; // merge cell
            sheet.Cells.Style.WrapText    = true; // auto new line

            // set backgroud
            sheet.Cells[1, 1].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
            sheet.Cells[1, 1].Style.Fill.BackgroundColor.SetColor(Color.FromArgb(128, 128, 128));

            // set border
            sheet.Cells[1, 1].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin, Color.FromArgb(191, 191, 191));
            sheet.Cells[1, 1].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            sheet.Cells[1, 1].Style.Border.Bottom.Color.SetColor(Color.FromArgb(191, 191, 191));

            // set cell row height and column width
            sheet.Cells.Style.ShrinkToFit = true; // auto adapter
            sheet.Row(1).Height           = 15;   // set row height
            sheet.Row(1).CustomHeight     = true; // auto adapter row height
            sheet.Column(1).Width         = 15;   // set column width.

            // set sheet background
            sheet.View.ShowGridLines           = false;                       // remove grid line
            sheet.Cells.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
            sheet.Cells.Style.Fill.BackgroundColor.SetColor(Color.LightGray); // set backgroud color
            sheet.BackgroundImage.Image = Image.FromFile(@"firstbg.jpg");     // set backgroud image

            // insert image
            ExcelPicture picture = sheet.Drawings.AddPicture("Logo", Image.FromFile(@"firstbg.jpg"));

            picture.SetPosition(100, 100);// set picture position
            picture.SetSize(100, 100);

            // insert shape
            ExcelShape shape = sheet.Drawings.AddShape("shape", eShapeStyle.Rect);

            shape.Font.Color        = Color.Red;
            shape.Font.Size         = 15;
            shape.Font.Bold         = true;
            shape.Fill.Style        = eFillStyle.NoFill;
            shape.Border.Fill.Style = eFillStyle.NoFill;
            shape.SetPosition(200, 300);
            shape.SetSize(80, 30);
            shape.Text = "Text";

            // add Hyperlink for image
            picture = sheet.Drawings.AddPicture("Logo", Image.FromFile(@"firstbg.jpg"), new ExcelHyperLink("http://www.cnblogs.com", UriKind.Relative));

            // add Hyperlink for cell
            sheet.Cells[1, 1].Hyperlink = new ExcelHyperLink("Http://www.cnblogs.com", UriKind.Relative);

            // hide sheet
            sheet.Hidden           = eWorkSheetHidden.Hidden;
            sheet.Column(1).Hidden = true;
            sheet.Row(1).Hidden    = true;
        }
Exemplo n.º 24
0
        public void ExportTagWithTemplate(Tag_ExportModel model)
        {
            FileInfo fileInfo = new FileInfo(model.templateFilePath);

            if (!fileInfo.Exists)
            {
                throw new Exception("未找到名为 " + model.templateFilePath + " 的模板");
            }
            using (var xlPackage = new ExcelPackage(fileInfo))
            {
                var worksheet = xlPackage.Workbook.Worksheets[model.SheetName_Big];
                if (worksheet == null)
                {
                    throw new Exception("模板中未包含名为 " + model.SheetName_Big + " 的Sheet");
                }

                #region 大标签
                var listTitle = worksheet.Drawings.Where(o => o.Name == "Title").ToList();
                foreach (var item in listTitle)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.ProductName;
                }

                var listHS = worksheet.Drawings.Where(o => o.Name == "HS").ToList();
                foreach (var item in listHS)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.HS;
                }

                var listWarning = worksheet.Drawings.Where(o => o.Name == "txtWarning").ToList();
                foreach (var item in listWarning)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.WarningContent;
                }

                var listHazardouDes = worksheet.Drawings.Where(o => o.Name == "HazardouDes").ToList();
                foreach (var item in listHazardouDes)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.HazardousDescription;
                }

                var listDefenceDes = worksheet.Drawings.Where(o => o.Name == "DefenceDes").ToList();
                foreach (var item in listDefenceDes)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.DefenceDes;
                }

                var listDealDES = worksheet.Drawings.Where(o => o.Name == "DealDES").ToList();
                foreach (var item in listDealDES)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.DealDES;
                }

                var listStoreDes = worksheet.Drawings.Where(o => o.Name == "StoreDes").ToList();
                foreach (var item in listStoreDes)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.StoreDes;
                }

                var listWasteHanding = worksheet.Drawings.Where(o => o.Name == "WasteHanding").ToList();
                foreach (var item in listWasteHanding)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.WasteHanding;
                }

                var listSupplierBig = worksheet.Drawings.Where(o => o.Name == "Supplier").ToList();
                foreach (var item in listSupplierBig)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.Supplier_Big;
                }


                #endregion

                var worksheet_small = xlPackage.Workbook.Worksheets[model.SheetName_Small];
                if (worksheet_small == null)
                {
                    throw new Exception("模板中未包含名为 " + model.SheetName_Small + " 的Sheet");
                }

                #region 小标签
                var listTitleSmall = worksheet_small.Drawings.Where(o => o.Name == "Title").ToList();
                foreach (var item in listTitleSmall)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.ProductName;
                }

                var listHSSmall = worksheet_small.Drawings.Where(o => o.Name == "HS").ToList();
                foreach (var item in listHSSmall)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.HS;
                }

                var listHazardouDesSmall = worksheet_small.Drawings.Where(o => o.Name == "HazardouDes").ToList();
                foreach (var item in listHazardouDesSmall)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.HazardousDescription;
                }

                var listSupplierSmall = worksheet_small.Drawings.Where(o => o.Name == "Supplier").ToList();
                foreach (var item in listSupplierSmall)
                {
                    ExcelShape shape = item as ExcelShape;
                    shape.RichText.Text = model.Supplier_Small;
                }
                #endregion

                #region 替换警示标识
                int cellCount = model.WarningPicPaths.Count;

                if (cellCount == 1)
                {
                    #region

                    string pName = "Picture3";
                    var    listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                    foreach (var item in listA)
                    {
                        var img = item as ExcelPicture;
                        img.Image = Image.FromFile(model.WarningPicPaths[0]);
                    }

                    var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                    foreach (var item in listB)
                    {
                        var img = item as ExcelPicture;
                        img.Image = Image.FromFile(model.WarningPicPaths[0]);
                    }

                    for (int i = 1; i < 6; i++)
                    {
                        if (i == 3)
                        {
                            continue;
                        }
                        string _pName = "Picture" + i;
                        var    _listA = worksheet.Drawings.Where(o => o.Name == _pName).ToList();
                        foreach (var item in _listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }

                        var _listB = worksheet_small.Drawings.Where(o => o.Name == _pName).ToList();
                        foreach (var item in _listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }
                    }
                    #endregion
                }
                else if (cellCount == 2)
                {
                    string pName = "";
                    #region
                    for (int i = 0; i < cellCount; i++)
                    {
                        if (i == 0)
                        {
                            pName = "Picture4";
                        }
                        else
                        {
                            pName = "Picture2";
                        }
                        var listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.WarningPicPaths[i]);
                        }

                        var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.WarningPicPaths[i]);
                        }
                    }
                    for (int i = 1; i < 6; i++)
                    {
                        if (i == 2 || i == 4)
                        {
                            continue;
                        }
                        pName = "Picture" + i;
                        var listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }

                        var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }
                    }
                    #endregion
                }
                else if (cellCount == 3)
                {
                    #region
                    string pName = "";

                    for (int i = 0; i < cellCount; i++)
                    {
                        if (i == 0)
                        {
                            pName = "Picture4";
                        }
                        else if (i == 1)
                        {
                            pName = "Picture3";
                        }
                        else
                        {
                            pName = "Picture2";
                        }
                        var listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.WarningPicPaths[i]);
                        }

                        var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.WarningPicPaths[i]);
                        }
                    }
                    for (int i = 1; i < 6; i++)
                    {
                        if (i == 2 || i == 4 || i == 3)
                        {
                            continue;
                        }
                        pName = "Picture" + i;
                        var listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }

                        var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }
                    }
                    #endregion
                }
                else if (cellCount == 4)
                {
                    #region
                    string pName = "";

                    for (int i = 0; i < cellCount; i++)
                    {
                        if (i == 0)
                        {
                            pName = "Picture5";
                        }
                        else if (i == 1)
                        {
                            pName = "Picture4";
                        }
                        else if (i == 2)
                        {
                            pName = "Picture3";
                        }
                        else
                        {
                            pName = "Picture2";
                        }
                        var listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.WarningPicPaths[i]);
                        }

                        var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.WarningPicPaths[i]);
                        }
                    }
                    for (int i = 1; i < 2; i++)
                    {
                        if (i == 1)
                        {
                            pName = "Picture" + i;
                            var listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                            foreach (var item in listA)
                            {
                                var img = item as ExcelPicture;
                                img.Image = Image.FromFile(model.BlankPicPath);
                            }

                            var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                            foreach (var item in listB)
                            {
                                var img = item as ExcelPicture;
                                img.Image = Image.FromFile(model.BlankPicPath);
                            }
                        }
                    }
                    #endregion
                }
                else if (cellCount == 5)
                {
                    int k = 1;
                    foreach (string picUrl in model.WarningPicPaths)
                    {
                        string pName = "Picture" + k;
                        var    listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(picUrl);
                        }

                        var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(picUrl);
                        }
                        k++;
                    }

                    for (int i = k; i < 6; i++)
                    {
                        string pName = "Picture" + i;
                        var    listA = worksheet.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listA)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }

                        var listB = worksheet_small.Drawings.Where(o => o.Name == pName).ToList();
                        foreach (var item in listB)
                        {
                            var img = item as ExcelPicture;
                            img.Image = Image.FromFile(model.BlankPicPath);
                        }
                    }
                }

                #endregion

                xlPackage.Save();
            }
        }