Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
93 views

Open XML: How to save an existing WordprocessingDocument to MemoryStream?

In my class, I receive a WordprocessingDocument object as a return from another method. I know the document was created in-memory (MemoryStream). Now, I need to either get the underlying MemoryStream ...
igorjrr's user avatar
  • 872
0 votes
1 answer
764 views

DocumentFormat.OpenXml: Is it possible to save word document to Memory Stream?

I am working on a function that allows me to create a simple word document from a string. I am using DocumentFormat.OpenXml Version="2.20.0" to create the word document. I don't understand ...
Alexandre Sobral Martins's user avatar
3 votes
3 answers
9k views

Open XML WordprocessingDocument with MemoryStream is 0KB

I am trying to learn how to use with Microsoft's Open XML SDK. I followed their steps on how to create a Word document using a FileStream and it worked perfectly. Now I want to create a Word document ...
lsauceda's user avatar
  • 345
0 votes
1 answer
323 views

Error using OpenXML to read a .docx file from a memorystream to a WordprocessingDocument to a string and back

I have an existing library that I can use to receive a docx file and return it. The software is .Net Core hosted in a Linux Docker container. It's very limited in scope though and I need to perform ...
James pearce's user avatar
0 votes
1 answer
3k views

Word found unreadable content error when opening file

I am facing an error "Word found unreadable content in abc.docx. Do you want to recover the content of this document?" while opening the Word (.docx) file. I have tried with all the solutions given ...
Devock's user avatar
  • 3
0 votes
1 answer
1k views

how to modify content in filestream while using open xml?

In the code below, I am merging some files together and saving them in the test.docx file. However, before I merg each file, I would like to first replace the text of some content controls which are ...
Burre Ifort's user avatar
2 votes
2 answers
5k views

How to convert Word document created from template by OpenXML into MemoryStream?

I need to return document as MemoryStream in ASP.NET controller method to download it at web page. I don't want to save this document on the file, and then read it as MemoryStream and return. Note: ...
sam sergiy klok's user avatar
1 vote
2 answers
2k views

OpenXML word document - open template, edit and download

I need to grap a word template, replace certain words and then download the document for the user - don't need to save to file. I've got the code from MS, got the document into a StreamReader to read ...
Sherry8212's user avatar
0 votes
0 answers
1k views

EPPlus with OpenXML and streams

I am trying to automate a Powerpoint presentation. I am using OpenXML to navigate the powerpoint presentation up to the point that I find the Excel linked to a chart. Now I want to use EPPlus to load ...
user2047485's user avatar
3 votes
1 answer
3k views

ClosedXml Cannot access a closed Stream

I am getting the "Cannot access a closed Stream" when I am trying to save a ClosedXML Workbook (XLWorkbook) to a memory stream. public byte[] GetStream() { using (var stream = new ...
Andrei Ivascu's user avatar
0 votes
1 answer
362 views

C# Memory Stream/OpenXML sometimes adds extra characters to file name

I export an Excel file using OpenXML and MemoryStream and it sometimes adds extra characters to the file path. It doesn't happen every time. When I first load it up for the day it seems to work just ...
JRich's user avatar
  • 13
1 vote
1 answer
300 views

Editing docx with openxml returns invalid memorystream

I created a DLL that takes a Word template, I have code that edits the document using openXML then the result is sent via memory stream to a web service where the documents is downloaded to the user. ...
David Cyr's user avatar
  • 263
0 votes
2 answers
2k views

Using in Class Property MemoryStream and IDisposable

I am creating an excel and powerpoint document using openxml. As I do not want to create emtpy file, I want to be sure to write the document only when it is complete using my own Save methods. It ...
Yoyo's user avatar
  • 101
4 votes
1 answer
574 views

Editing & saving .docx in ASP.NET program using OpenXML & MemoryStream

I'm writing a project which allows you to edit .docx documents (I have a template that needs to be edited) directly from the site and save them to your computer. I have a problem with saving all ...
boyd174's user avatar
  • 41
5 votes
2 answers
5k views

Trying to read an Excel file file stream in C#, I get numbers instead of text

I'm trying to use DocumentFormat.OpenXml to read an uploaded Excel file. When I get the file (HttpPosteFileWrapper) I'm simply trying to read the cells and write them to a text string. (Later I will ...
M Kenyon II's user avatar
  • 4,254
2 votes
2 answers
3k views

Insert Drawing.Image into WordprocessingDocument body

I have a code were I read a docx document in byte array format with System.IO. Later I make a stream of the docx byte array and use WordprocessingDocument to edit the docx stream. I edit/replace tags ...
HenrikP's user avatar
  • 854
8 votes
3 answers
24k views

C# return memory stream from OpenXML resulting to a corrupted word file

I have a problem with a MemoryStream from OpenXML. I succeed with opening a Word file, changing it and downloading it through the HttpResponse if I do all the steps in a single method. But if I try ...
DotNetBeliever's user avatar
0 votes
1 answer
1k views

Loading binary file from db and process it as openxml

I have such method to load document file from db that is stored as binary and then replace customxml parts with parameters. Somehow when i convert byte into MemoryStream then process it doesn't work,...
apprich's user avatar
  • 144
13 votes
4 answers
9k views

Excel and "unreadable content" when creating an Open XML spreadsheet with MemoryStream

When creating an Excel spreadsheet using the Open XML SDK v2.0, our Excel output initially worked successfully for a number of months. Recently Excel (all versions) began to complain about "Excel ...
energyiq's user avatar
  • 141
0 votes
2 answers
645 views

In-memory XML manipulation

I'm trying to do a find and replace in an OpenXML word document which I've openened into a MemoryStream. using (WordprocessingDocument _document = WordprocessingDocument.Open(_ms, true)) { var ...
fearofawhackplanet's user avatar