I downloaded the trial version and before I purchase a license I am wondering if this is a bug? I can't seem to figure out what is going on.
I have a word document and I used Spire.Doc to split the Word document by page break using the tutorial on this site. I tried linking to the tutorial but this won't let me.
Everything seemed to work fine. I then tried to convert each docx into an html file. So I did a simple modification of the tutorial on this site to perform this with a foreach file in a folder.
I tried linking to the tutorial but this won't let me.
However, some of the files that were split using the step above are throwing an exception in the convert code below. I get the following exception:
System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index'
I am not using a parameter name of index? Which makes me think it is a bug.
And the resulting .html is only a partial of the .docx input file. Can anyone else duplicate this error? Any help would be appreciated.
I have attached the input file and the output file for the save to html in a zip.
- Code: Select all
string[] strFiles = Directory.GetFiles(@"E:\junk\result");
int iFileIndexer = 0;
foreach (string strFile in strFiles)
{
Spire.Doc.Document objDocument = new Spire.Doc.Document();
objDocument.LoadFromFile(strFile);
try
{
string strOutFileName = @"E:\junk\html\html" + iFileIndexer.ToString() + ".html";
objDocument.SaveToFile(strOutFileName, FileFormat.Html); //[b]<<<---------- Exception here[/ b]
objDocument.Close();
}
catch (Exception objException)
{
objDocument.Close();
}
iFileIndexer++;
}