We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error adding Tif picture to excel

I get an error in the following code when trying to add a Tif image to the Pictures collection of an excel file. The logo variable below is a byte array which represents the Tif image and similar code for aspose.words works without error. Is there a limitation on the types of images aspose.cells allows to be added to the Pictures collection?

//add image
Worksheet sheet = wb.Worksheets[0];
int index = sheet.Pictures.Add(1, 1, new MemoryStream(logo));

System.ArgumentException was unhandled
Message=Unknown image format:Unsupported image format.
Source=Aspose.Cells
StackTrace:
at x09c69e69f05a0f64.xfd0364e33cd32983.xd6b6ed77479ef68c(Stream xcf18e5243f8d5fd3)
at x09c69e69f05a0f64.xad9b6174740c7664.xa9557f69810d0afe(Int32 x5ff24612d1e3b631, Stream xcf18e5243f8d5fd3)
at x09c69e69f05a0f64.xfee552314006c468.xa8a795be8f94b493(Shape x5770cdefd8931aa9, Stream x4a3f0a05c02f235f)
at Aspose.Cells.Shapes.xd6b6ed77479ef68c(Shape x5770cdefd8931aa9, Stream x4a3f0a05c02f235f)
at Aspose.Cells.Shapes.AddPicture(Int32 upperLeftRow, Int32 upperLeftColumn, Stream stream, Int32 widthScale, Int32 heightScale)
at Aspose.Cells.Pictures.Add(Int32 upperLeftRow, Int32 upperLeftColumn, Stream stream, Int32 widthScale, Int32 heightScale)
at Aspose.Cells.Pictures.Add(Int32 upperLeftRow, Int32 upperLeftColumn, Stream stream)
at AsposeHelper.Helper.BuildExcel(Byte[] inputFile, String extension, Byte[] logo) in C:\Projects\Examples\Sandbox\Developers\Kirk Quinbar\AsposeTest\AsposeHelper\Helper.cs:line 81
at AsposeTest.MainWindow.BuildButton_Click(Object sender, RoutedEventArgs e) in C:\Projects\Examples\Sandbox\Developers\Kirk Quinbar\AsposeTest\AsposeTest\MainWindow.xaml.cs:line 65
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AsposeTest.App.Main() in C:\Projects\Examples\Sandbox\Developers\Kirk Quinbar\AsposeTest\AsposeTest\obj\x86\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Hi,

I am afraid, TIF image format is not supported for Pictures.Add() method. We will support it soon.

I have logged your feature request into our issue tracking system with an issue id: CELLSNET-17999.

Once we have any update about it, I will inform you.

Thank you.

Hi,

Please try the attached version v5.0.0.4. We have supported the Tif format now.

Thank you.

wow thanks for the quick response!

The issues you have found earlier (filed as 17999) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.