We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert Save As HTML File to DOCX and Upload DOCX File to Document Library of SharePoint Server C# .NET

Hi Team,

I am using Aspose.Words for converting HTML file to Docx via c#. I need to Upload Docx file to SharePoint document Library, however i don’t want to save file in local directory.
Please suggest me way in which files can be uploaded to SharePoint document library without saving file into the local directory.

Please guide.

@rupeshSPDev,

You can convert HTML file to DOCX stream (byte array etc) by using following C# Code of Aspose.Words for .NET API:

Document doc = new Document("E:\\Temp\\in.html");

MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.Docx);
stream.Position = 0;

byte[] bytes = stream.ToArray();

After that you can upload the DOCX stream or byte[] array to SharePoint’s Document Library. Of-course, you do not need Aspose.Words for .NET to push files to SharePoint’s Document Library. Instead, Microsoft provides an API for that in Microsoft.SharePoint namespace.

For example, you can use SPFolder.Files.Add() to add a file. An example here: SPFileCollection class might be helpful.

thanks it worked for me.