Search code examples
vb.netexcelparsinguriinfragistics

Infragistics Excel Import Loadoptions


there are two Errors came up on the Load-Method for loading Excel-Sheets through Infragistics Components.

First:

  • The specified stream or file does not contain a valid workbook. Parametername: fileName

This ist because the Excel-Workbook is corrupt. But how can I load the Workbook without validating if its corrupt or not?

Second:

  • Invalid URI: The hostname could not be parsed

This is because there are Hyperlinks in Worksheets. How can I remove them before Loading?

My Code:

'stuff...
Dim file as String = "test.xls"
xls = New Workbook()
xls = Workbook.Load(file)
'stuff...

The Page from Infragistics is not very helpful: http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/html/Infragistics4.Documents.Excel.v12.2~Infragistics.Documents.Excel.Workbook~Load(Stream).html


Solution

  • Ok guys, Thank you for the Response! Answer ist following:

    First Question was:

    • The specified stream or file does not contain a valid workbook. Parametername: fileName

    Answer:

    • There is no Option to Load a corrupt Workbook into your App without validating the Workbook or something like this. You need to handle this Errormessage and the User must choose another, valid File!

    Second Question was:

    • Invalid URI: The hostname could not be parsed

    Answer:

    • There were mailto-Links in the Worksheets. Normally this is not a Problem for Infragistics. But the mailto Links were broken like this:

      mailto:eric@ domain.com

    • You see: A space bar in that mailto-Link - so the Link is corrupt. The Invalid Uri came up because of this.