memorystream

how to modify content in filestream while using open xml?

非 Y 不嫁゛ 提交于 2019-12-11 17:39:33
问题 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 used as place holders. Can someone show me how to do that? suppose I have one content control in template2 and it is called placeholder1. How can I add text to this placeholder while usig the filestream? string fileName = Path.Combine(@"Docs\templates", "test.docx"); for (int i = 1; i < 3; i++) {

Generating PDF byte array

↘锁芯ラ 提交于 2019-12-11 16:48:20
问题 I have a static method like this and I am using ITextSharp to generate PDF.. public static byte[] createPDF(string htmlstr) { var html = @"<?xml version=""1.0"" encoding=""UTF-8""?> <!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd""> <html xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" lang=""en""> <head> <title>Minimal XHTML 1.0 Document with W3C DTD</title> </head> <body> " + htmlstr + "</body></html>"; // step 1:

Error: Unexpected end of stream. Data might be corrupted

不羁岁月 提交于 2019-12-11 15:58:39
问题 I'm trying something with stream data. I'm getting an error. I have some codes like below. One of both works, but another is not. This code works properly. private static void Main_2() { { var i = 1000000; var bf = new BinaryFormatter(); var ms = new MemoryStream(); bf.Serialize(ms, i); ms.Position = 0; Stream mem = File.Create("test.lz4"); LZ4EncoderStream target = LZ4Stream.Encode(mem); ms.CopyTo(target); target.Dispose(); ms.Dispose(); mem.Dispose(); } { Stream source = File.OpenRead("test

Save file to device with memorystream

蹲街弑〆低调 提交于 2019-12-11 15:47:13
问题 I was wondering if it is possible with xamarin.forms to download any type of file to the device.. de files are stored on Azure, i get a Memorystream of the file, its very important for my app. my question excists of 2 parts actually, how to download de file to the device of the user?, and how to show the file of Any type in a default application of the type ( like pdf reader) this is what i tried MemoryStream memoryStream = AzureDownloader.DownloadFromAzureBlobStorage(null, doc.azure

Strange Sudden Error “The number of bytes to be written is greater than the specified ContentLength”

余生长醉 提交于 2019-12-11 08:47:52
问题 I'm uploading bitmap images to Azure Blob Storage. It was all working fine, but then I made a new project to use the same code but now I get this error consistently "The number of bytes to be written is great than the specified ContentLength" Here's part of my code memoryStream.Seek(0, SeekOrigin.Begin); try { cloudBlobContainer.GetBlockBlobReference(resourcename).UploadFromStream(memoryStream); return true; } catch (Exception exception) { ReportHelper.Report(Tag, "Error occurred while

Delphi: play memorystream in wmp activex

走远了吗. 提交于 2019-12-11 07:49:11
问题 I'm new to this site and I hope someone can help me with my problem. I am using a Delphi language. And I would want to play a memorystream to windowsmediaplayer ActiveX. Is this possible? If it is, can someone give me a hint or something.. sample code maybe. Thanks. 回答1: I can't speak for Delphi 2009, but earlier version of Delphi didn't support this with the TMediaPlayer component. What you could do is write the MemoryStream to a temporary file, then have the TMediaPlayer load that file.

Upload Big ZipArchive-MemoryStream to Azure

左心房为你撑大大i 提交于 2019-12-11 04:32:58
问题 TL;DR : Is it possible to upload a big MemoryStream to Azure as chunks on the fly while zipping? I have files which get saved into a MemoryStream , I add these files to a ZipArchive in another MemoryStream. This MemoryStream I want to upload to an Azure-BlockBlob-Storage using blockBlob.UploadFromStream(zipMemoryStream); So far so good. The Problem now is, that the Zip-Archive might get bigger then 8GB which is a problem with the MemoryStream. Is it possible to upload parts from the memory

How can I load a memory stream into LibVLC?

怎甘沉沦 提交于 2019-12-11 04:08:41
问题 I want to play a media file from a memory stream using LibVLC like so: //Ideally it would go like this: LibVLC.MediaFromStream = new MemoryStream(File.ReadAllBytes(File_Path)); Of course this is a very oversimplified version of what I want but hopefully it conveys what I am looking for. The reason being that I want there to be a good amount of portability for what I'm doing without having to track file locations and such. I'd rather have a massive clump of data in a single file that can be

Can WCF MemoryStream return type be written to the Http Response object for downloading as an Excel file?

允我心安 提交于 2019-12-11 03:57:24
问题 I built a parsing application that reads xml files and populates an Excel workbook using the NPOI library. Originally, I had that as part of my .net web app and would get the MemoryStream from NPOI and write that to the Response object so the browser would download it. I've since moved the parsing to a WCF netTcp service hosted in a Windows Service. The communication works great, but when I return the MemoryStream from the WCF service and write it to the response, I get the following error:

ASP.NET C# upload MemoryStream content via FTPwebRequest issue

末鹿安然 提交于 2019-12-11 03:48:21
问题 This should be pretty straight forward, and uploading works. BUT when I open the uploaded file on the FTP server it shows binary data which is just some weird characters that look like this [][][][], and its the right file size. how do I add attributes or headers that that will say that this file is an XML? public bool ProcessBatch(MemoryStream memStream) { bool result = true; FTPaddress = DistributionResources.ftpServer; CompleteFTPPath = DistributionResources.ftpPath; request =