Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.dotnet.vb.general
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Validation message increases file size? | Excel Discussion (Misc queries) | |||
File size increases when using Microsoft Open XML Converter | Excel Discussion (Misc queries) | |||
Excel file size increases when editing same info | Excel Discussion (Misc queries) | |||
Why does Excel file size increase GREATLY with only a SMALL pictu | Excel Discussion (Misc queries) | |||
Importing .txt data files increases .xls file size | Excel Discussion (Misc queries) |