![]() |
small GIF massively increases excel file size
When I add a gif file to an excel workbook using the shapes.addpicture
method the file size increases massively from 55kb to over 1mb for a 15k Gif file! I am using the office 10 object model. I think that the addpicture method must be converting the embedded file to a bitmap to store the file. This didn't occur with previous methods like Worksheet.Pictures.Insert but they don't seem to be accessible in office 10. Is there any way to avoid this ? I include the code that I use to attach the gif file below. oSheet = CType(m_oExcelWrkbk.ActiveSheet, Excel.Worksheet) oCell = CType(oSheet.Cells(m_oPosition.Y, m_oPosition.X), Excel.Range) oCell.Select() ' pick a cell that is far away to avoid difficulties with resized columns oCell = CType(oSheet.Cells(65535, 200), Excel.Range) iExcelCellSpan = 15 lngWidth = CType(oCell.Width, Single) * iExcelCellSpan lngHeight = CType(CType(oCell.Width, Single) * iExcelCellSpan * (4 / 9), Single) ' aspect ratio Filename = utilities.GetLocalPathFromURL(Filename) oShape = oSheet.Shapes.AddPicture(Filename, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 0, CType(oCell.Height, Single) * m_oPosition.Y, lngWidth, lngHeight) oShape.Placement = Excel.XlPlacement.xlFreeFloating As an alternative I have thought of using the shapes.addoleobject as but this just seems to throw an excel exception oSheet.Shapes.AddOLEObject("giffile", Filename, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, , , , 0, CType(oCell.Height, Single) * m_oPosition.Y, lngWidth, lngHeight) any ideas on either of the above would be greatly appreciated. |
All times are GMT +1. The time now is 05:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com