using GemBox.Spreadsheet;classProgram{staticvoidMain(){// If using the Professional version, put your serial key below.SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");var workbook =newExcelFile();var worksheet = workbook.Worksheets.Add("Images");// Add small BMP image with specified rectangle position.worksheet.Pictures.Add("SmallImage.bmp",50,50,48,48, LengthUnit.Pixel);// Add large JPG image with specified top-left cell.worksheet.Pictures.Add("FragonardReader.jpg","B9");// Add PNG image with specified top-left and bottom-right cells.worksheet.Pictures.Add("Dices.png","J16","K20");// Add GIF image using anchors.var picture = worksheet.Pictures.Add("Zahnrad.gif",newAnchorCell(worksheet.Columns[9], worksheet.Rows[21],100000,100000),newAnchorCell(worksheet.Columns[10], worksheet.Rows[23],50000,50000));// Set picture's position mode.picture.Position.Mode = PositioningMode.Move;// Add SVG image with specified top-left cell and size.picture = worksheet.Pictures.Add("Graphics1.svg","J9",250,100, LengthUnit.Pixel);// Set picture's metadata.picture.Metadata.Name ="SVG Image";workbook.Save("Images.xlsx");}}
GemBox.Spreadsheet supports all popular image formats like PNG, JPEG, EXIF, GIF, TIFF, ISO, SVG, EMF, and WMF. However, note that only PNG, JPEG, and EMF images are supported in XLS files (old binary format).
In PDF files, the SVG images are rendered as vector graphics, resulting in smaller file sizes and better quality than bitmap images (PNG, JPEG, BMP, etc.).
No hay comentarios:
Publicar un comentario