Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Sep 23, 2025 8:35 am

I'm trying to load a markdown-snippet into a spire document.

When I call the following, it works correctly:
Code: Select all
document.LoadFromFile(@"example.md", FileFormat.Markdown);


But when I try to load the markdown from a stream:
Code: Select all
public static Document LoadMarkdownDocument(string markdown)
{
   var document = new Document();
   using (var content = new MemoryStream(Encoding.Default.GetBytes(markdown)))
   {
      document.LoadFromStream(content, FileFormat.Markdown);
   }
   return document;
}


This does not work, it gives a "The file format cannot be supported.". Is this suppose to work?

And if not, is there another way to insert markdown into a Spire Document?

MarcelEmpirion
 
Posts: 6
Joined: Fri Jan 02, 2015 8:26 am

Tue Sep 23, 2025 9:38 am

Hello,

Thank you for your inquiry.
I have reproduced the issue you encountered – the "System.NotSupportedException: The file format cannot be supported." error. This issue has been logged in our tracking system under ID SPIREDOC-11541, and our development team will further investigate and fix it. We will provide you with an updated version once the issue is resolved. Thank you for your understanding.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Fri Oct 24, 2025 10:43 am

Hello,

Glad to inform you that our latest version(Spire.Doc Pack(Hot Fix) Version:13.10.3) has fixed the issue(SPIREDOC-11541). Welcome to test. Looking forward to your testing feedback.
Website:
https://www.e-iceblue.cn/Downloads/Spire-Doc-NET.html
Nuget:
https://www.nuget.org/packages/Spire.Doc/13.10.3
https://www.nuget.org/packages/Spire.Docfor.NETStandard/13.10.3
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Return to Spire.Doc