We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

InvalidCastException: Can''t convert value to string

Thread ID:

Created:

Updated:

Platform:

Replies:

97780 Jan 7,2011 04:21 AM Feb 14,2011 07:46 AM WPF 5
loading
Tags: XlsIO
Dan Ove Aalstad
Asked On January 7, 2011 04:21 AM

I get this exception when I try to save a xls file.
Is this a known issue?


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Can't convert value to string.
at Syncfusion.CompoundFile.XlsIO.DocumentPropertyImpl.get_Text()
at Syncfusion.XlsIO.Implementation.WorkbookImpl.get_Author()
at Syncfusion.XlsIO.Implementation.WorkbookImpl.WorkbookExcel97Serializator.Serialize(OffsetArrayList records, ExcelSaveType saveType, IEncryptor encryptor, WorkbookImpl book, WorksheetImpl sheet, Boolean forClipboard)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.WorkbookExcel97Serializator.Serialize(Stream stream, WorkbookImpl book, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(Stream stream, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(Stream stream)


Regards
Dan Ove


Sridhar [Syncfusion]
Replied On January 10, 2011 03:49 AM

Hi Dan,

Thank you very much for using Syncfusion products.

The exception posted in the last update seems to be occurred while parsing or serializing the document properties of the Excel file. Could you please update us the below details to proceed further on this issue.

Details required:
1)Whether the exception occurs while reading an existing file or creating a new file.
2)If it occurs while creating a new file, can you please update us the code snippet you have tried at your side.
3)If it occurs while reading from an existing file, can you please update us the issue reproducing Excel file.
4)Currently using Syncfusion Essential studio version.

Please let us know if you need any clarifications.

Thanks,
Sridhar S



Dan Ove Aalstad
Replied On January 21, 2011 06:03 AM

Hi

We are still investigating the issue. The error occurs after we have opened an existing FileStream, changed some text and save the changes back to a new Stream.

The problem is that the bug only affects some users (PC's) so it is difficult to debug.

Regards

Dan Ove


Sridhar [Syncfusion]
Replied On January 24, 2011 07:03 AM

Hi Dan,

Thanks for the update.

The error occurs when reading and writing the streams of the file you are using.Could you please send us the sample you are using and the code snippet for read/write of an Filestream. So that we can move further analysing on this issue.

Please let us know if you need any clarifications.

Thanks,
Sridhar S



Dan Ove Aalstad
Replied On February 14, 2011 03:47 AM

Hi

It seems that I made a workaround to the issue.
I haven’t got any more exceptions after I added a line that set the author after opening the workbook. This workaround is tested in 8.4.0.10. I haven’t upgraded and tested 9.1.0.20 yet.

IWorkbook workbook = application.Workbooks.Open(documentStream);
workbook.Author = unitOfWork.Session.CurrentUser.FullName;



Sridhar [Syncfusion]
Replied On February 14, 2011 07:46 AM

Hi Dan,

Thanks for the update.

If possible, could you please update us with the simplified issue reproducing sample and the input template, so that we will fix this issue and update you with the patch.

Please let us know if you have any clarifications.

Thanks,
Sridhar.S


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;