Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.dotnet.vb.general
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation message increases file size? Code Numpty Excel Discussion (Misc queries) 0 February 23rd 10 02:19 PM
File size increases when using Microsoft Open XML Converter Simen Solbakken Excel Discussion (Misc queries) 1 October 26th 09 02:45 PM
Excel file size increases when editing same info Ron Bevan Excel Discussion (Misc queries) 3 July 25th 06 03:53 PM
Why does Excel file size increase GREATLY with only a SMALL pictu Bandar Excel Discussion (Misc queries) 1 November 2nd 05 02:17 PM
Importing .txt data files increases .xls file size BrianJ Excel Discussion (Misc queries) 1 January 29th 05 02:02 PM


All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"