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. Image for the cookie policy date

On .net 5 and 6 DocIO not read FileStream when Reginal format is Thai


On .NET 5 or 6 DocIO can't read html file when the Regional format is Thai (Thailand).

It will throw error System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'startIndex')'

public IActionResult CreateDocumentWord()
            //Set Thailand culture
            CultureInfo.CurrentCulture = new CultureInfo("th-TH");
            FileStream fileStreamPath = new FileStream("Sample.html", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            //Opens an existing document from file system through constructor of WordDocument class
            using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Html))
                MemoryStream stream = new MemoryStream();
                document.Save(stream, FormatType.Docx);
                //Closes the Word document
                stream.Position = 0;
                //Download Word document in the browser
                return File(stream, "application/msword", "HTMLtoWord.docx");

1 Reply

AA Akash Arul Syncfusion Team November 16, 2022 01:10 PM

We have confirmed that the reported issue ArgumentOutOfRangeException throws while opening HTML document when current culture is Thailand” is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release which is estimated to be available on end of November 2022.

The status of this bug can be tracked through the below link:

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”

Live Chat Icon For mobile
Up arrow icon