Devexpress SpreadSheet 如何在工作表中插入图片
来源:互联网 发布:数据透视表生成图表 编辑:程序博客网 时间:2024/05/21 08:36
基于文件流法:
workbook.BeginUpdate();// Set the measurement unit to Millimeter.workbook.Unit = DevExpress.Office.DocumentUnit.Millimeter;try{ Worksheet worksheet = workbook.Worksheets[0]; // Insert a picture from a file so that its top left corner is in the specified cell. // By default the picture is named Picture 1.. Picture NN. worksheet.Pictures.AddPicture("Pictures\\x-docserver.png", worksheet.Cells["A1"]); // Insert a picture at 70 mm from the left, 40 mm from the top, // and resize it to a width of 85 mm and a height of 25 mm, locking the aspect ratio. worksheet.Pictures.AddPicture("Pictures\\x-docserver.png", 70, 40, 85, 25, true); // Insert the picture to be removed. worksheet.Pictures.AddPicture("Pictures\\x-docserver.png", 0, 0); // Remove the last inserted picture. // Find the shape by its name. The method returns a collection of shapes with the same name. Picture picShape = worksheet.Pictures.GetPicturesByName("Picture 3")[0]; picShape.Delete();}finally{ workbook.EndUpdate();}
基于URL法:
string imageUri = "https://www.devexpress.com/Products/NET/Controls/WinForms/spreadsheet/i/winforms-spreadsheet-control.png";// Create an image from Uri.SpreadsheetImageSource imageSource = SpreadsheetImageSource.FromUri(imageUri, workbook);// Set the measurement unit to point.workbook.Unit = DevExpress.Office.DocumentUnit.Point;workbook.BeginUpdate();try{ Worksheet worksheet = workbook.Worksheets[0]; // Insert a picture from the SpreadsheetImageSource at 100 pt from the left, 40 pt from the top, // and resize it to a width of 300 pt and a height of 200 pt. worksheet.Pictures.AddPicture(imageSource, 100, 40, 300, 200);}finally{ workbook.EndUpdate();}
如何修改:
workbook.Unit = DevExpress.Office.DocumentUnit.Millimeter;workbook.BeginUpdate();try{ Worksheet worksheet = workbook.Worksheets[0]; // Insert pictures from the file. Picture pic = worksheet.Pictures.AddPicture("Pictures\\x-docserver.png", worksheet.Cells["A1"]); // Specify picture name and draw a border. pic.Name = "Logo"; pic.AlternativeText = "Spreadsheet Logo"; pic.BorderWidth = 1; pic.BorderColor = DevExpress.Utils.DXColor.Black; // Move a picture. pic.Move(20, 30); // Change picture behavior so it will move and size with underlying cells. pic.Placement = Placement.MoveAndSize; worksheet.Rows[5].Height += 10; worksheet.Columns["D"].Width += 10; // Specify rotation angle. pic.Rotation = 30; // Add a hyperlink. pic.InsertHyperlink("http://www.devexpress.com/Products/NET/Document-Server/", true);}finally{ workbook.EndUpdate();}
0 0
- Devexpress SpreadSheet 如何在工作表中插入图片
- 如何在窗体中插入图片标签
- 如何在QR二维码中插入图片
- 在Adobe Acrobat 中如何插入图片
- ITeye如何在博客中插入图片
- 如何在QR二维码中插入图片
- word如何在图片中插入文字
- 如何在netbeans中插入图片背景
- 如何在iMindMap 9中插入图片
- 如何在CSDN博客中插入图片
- poi如何在excel中插入图片
- 2 如何在CSDN中插入图片
- 如何在CSDN博客中插入图片
- 如何在DevExpress ASPxGridView中进行编辑
- 如何在CHtmlEditView中插入图片以及其他元素
- Drupal7如何使用CKEDITOR在文章中插入图片
- Directshow 如何在视频中插入水印Logo图片
- 求助:如何在博客中快速插入图片
- 数据挖掘——单层感知器算法简介
- 红绿灯难题
- 用php代码限制国内IP访问我们网站
- 随机抽样一致性(RANSAC)算法
- Studio SeekBar拖动条写法+调整亮度权限+RatingBar评星控件
- Devexpress SpreadSheet 如何在工作表中插入图片
- Android图片压缩(质量压缩和尺寸压缩)
- C#入门3.2——常量
- 面试常见题型总结
- 【HDU】5783 Divide the Sequence
- 股票数据
- SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)
- Apache设置多个监听端口与架设多个网站的方法
- 搞懂树状数组