|
Hello All,
need to convert Word Document Content Like Mail Merge and Convert It in to OPEN XML, please, do the need full.
Thanks In Advance
|
|
|
|
|
If by "do the needful" you mean write your code for you, that's just not going to happen.
You haven't said anything at all about where you're stuck in this process, so it's pretty much impossible to tell you what's going on.
|
|
|
|
|
Dave, fyi, the expression "do the needful" is a Hindi-English idiom often used in correspondence; in this case it may not have the meaning of "gimme codez" ... or, it might
yours, Bill
“Human beings do not live in the objective world alone, nor alone in the world of social activity as ordinarily understood, but are very much at the mercy of the particular language which has become the medium of expression for their society. It is quite an illusion to imagine that one adjusts to reality essentially without the use of language and that language is merely an incidental means of solving specific problems of communication or reflection." Edward Sapir, 1929
|
|
|
|
|
I know where it's from and it can be traced back to about the 1700's in British English.
But, since the OP doesn't specify anything at all about what he's looking for, I just had to guess and us an "if" in preface to the most likely possibility.
|
|
|
|
|
Hi Dave,
I am delighted to know you are familiar with such constructions (the more common form, I believe, is "do the necessary") [^]. I'm not sure whether, technically, these (now archaic) forms qualify as calques, and/or Anglicisms.
Have you lived in India, or is there a family connection with the Raj ?
Hope my response to you did not seem patronizing
yours, Bill
“Human beings do not live in the objective world alone, nor alone in the world of social activity as ordinarily understood, but are very much at the mercy of the particular language which has become the medium of expression for their society. It is quite an illusion to imagine that one adjusts to reality essentially without the use of language and that language is merely an incidental means of solving specific problems of communication or reflection." Edward Sapir, 1929
|
|
|
|
|
BillWoodruff wrote: Have you lived in India, or is there a family connection with the Raj ?
Oh God, no! I just went and did the homework to find out my it's so popular in India, and, to a lesser extent, South Asia English.
BillWoodruff wrote: Hope my response to you did not seem patronizing
No, no. We're good!
|
|
|
|
|
Hi Meetnneel,
Please describe what you have done so far, post the code you have written so far, and discuss what specific problems you are having with it.
yours, Bill
“Human beings do not live in the objective world alone, nor alone in the world of social activity as ordinarily understood, but are very much at the mercy of the particular language which has become the medium of expression for their society. It is quite an illusion to imagine that one adjusts to reality essentially without the use of language and that language is merely an incidental means of solving specific problems of communication or reflection." Edward Sapir, 1929
|
|
|
|
|
I am successfully using .NET's BinaryFormatter to serialize a very complex object (an instance, at run-time) into a MemoryStream, and I can save that to a file, and then de-serialize the file back into an instance of the object.
Then, I wanted to add compressing the MemoryStream using GZip [1], before saving it to a file.
I am, without compile- or run- time error, using .NET's GZip facility to GZip the created MemoryStream, and then save it to a disk file.
To summarize the save-to-file sequence:
1. use BinaryFormatter to serialize the object to a MemoryStream
2. use GZip to compress the MemoryStream
3. write the Gzipped MemoryStream to disk
I've already learned the hard way that there is a quirk in using GZip in .NET in compressing [^].
I verify that the file is written, and it appears to have been "shrunk" by the GZip facility.
But, when I try to reverse the process, to essentially deserialize (recreate) the object by:
1. reading the Gzipped saved file into a MemoryStream
2. using GZip's Decompress on the MemoryStream
3. using BinaryFormatter to deserialize the MemoryStream, which I then cast into the Type of the original object: fail.
The point I am stuck at is expressed in this code:
using (GZipStream deCompressionStream = new GZipStream(new MemoryStream(), CompressionMode.Decompress))
{
deCompressionStream.CopyTo(newMemoryStream);
}
BinaryFormatter bFormatter = new BinaryFormatter();
object obj = bFormatter.Deserialize(newMemoryStream); Thanks in advance for any advice.
yours, Bill
[1] I set out to explore using GZip as a way to increase my general knowledge of .NET's stream facilities, and after learning how to successfully use Mehdi Gholam's fastBinaryJSON work here on CP, and using the MiniLZO class in Mehdi's Raptor Document Store.
“Human beings do not live in the objective world alone, nor alone in the world of social activity as ordinarily understood, but are very much at the mercy of the particular language which has become the medium of expression for their society. It is quite an illusion to imagine that one adjusts to reality essentially without the use of language and that language is merely an incidental means of solving specific problems of communication or reflection." Edward Sapir, 1929
|
|
|
|
|
You're passing an empty MemoryStream to the GZipStream s constructor. You need to pass the stream containing the previously compressed data instead.
using (var fileStream = File.OpenRead(@"Path\To\Your\File.bin"))
using (var deCompressionStream = new GZipStream(fileStream, CompressionMode.Decompress))
{
var bFormatter = new BinaryFormatter();
object obj = bFormatter.Deserialize(deCompressionStream);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard, thanks very much for your example !
Your deserialization code is one of the first variations I tried, and it fails to deserialize with an error: "The magic number in GZip header is not correct. Make sure you are passing in a GZip stream."
Clearly my Gzipping is not being done properly. This is confirmed by this experiement: if I modify your code like this:
using (var fileStream = File.OpenRead(filePath))
using (var deCompressionStream = new GZipStream(fileStream, CompressionMode.Decompress))
{
var bFormatter = new BinaryFormatter();
object obj = bFormatter.Deserialize(fileStream);
return null;
} That confirms to me I did not GZip properly.
I tried several variations of GZipping found on MSDN, and StackOverFlow: almost all these examples use source.CopyTo(destination) in some form, within the using statements bracketing the use of GZipStream, evidently for the reason there is a known problem with GZipping not being completed fully until after it exits the 'using statement closure, as referenced here: [^].
So, the burden shifts back to finding the correct way for Gzipping.
thanks again for your time, Bill
|
|
|
|
|
You're copying streams which isn't required; they're based on the decorator-pattern. Below example should work (albeit the GZipped version will be bigger since it's a small class)
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.IO.Compression;
[Serializable()]
class SumTestClass
{
public int TestInt { get; set; }
public string TestString { get; set; }
public SumTestClass()
{
TestInt = 42;
TestString = "Hello World";
}
}
static class Program
{
static BinaryFormatter bf = new BinaryFormatter();
static void Main(string[] args)
{
object thingyToSerialize = new SumTestClass();
using (var ms = new FileStream("C:\\Temp\\Test.zip", FileMode.Create))
using (var zs = new GZipStream(ms, CompressionMode.Compress, leaveOpen: true))
{
bf.Serialize(zs, thingyToSerialize);
Console.WriteLine("Stuff saved");
}
using (var ms = new FileStream("C:\\Temp\\Test.zip", FileMode.Open))
using (var zs = new GZipStream(ms, CompressionMode.Decompress, leaveOpen: true))
{
SumTestClass testResult = bf.Deserialize(zs) as SumTestClass;
Console.WriteLine("String: {0}\nInt: {1}", testResult.TestString, testResult.TestInt);
}
Console.ReadLine();
}
} Hope it helps a bit, yell if it doesn't
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks, Eddy !
Your code works with a MemoryStream that has been Gzipped, Serialized, and written to a file.
The 'leaveopen parameter ... in both gzip, and un-gzip ... appears to be redundant: my implementation of your code works with, or without, them.
It compresses a 9mb object=>source-stream to a little over 3mb disk file, whether Compression setting is 'Fastest, or 'Optimal.
"Raising the stakes" from 100k to 1 million total objects yielded a 98+ megabyte MemoryStream that Gzipped to a 30.6mb file with both 'Optimal, and 'Fastest compression. That does make me question the efficiency of Gzip in .NET.
But (hypothesis), perhaps the complex object I am Gzipping and Serializing is, by its nature not highly compressible ?
It is much better to have working code you don't quite understand, than to have code you believe you understand, and expect to work, that does not work
When I feel like I fully understand how I "strayed onto the wrong path" for so many hours, yesterday, and understand exactly why your code works, I feel I should write up a Tip-Trick for CP.
I didn't realize that by using a ".gz" extension to the files I created I was creating something that could be opened with WinRar !
yours, Bill
~
"This isn't right. This isn't even wrong." Wolfgang Pauli"
|
|
|
|
|
You're welcome
BillWoodruff wrote: "Raising the stakes" from 100k to 1 million total objects yielded a 98+ megabyte MemoryStream that Gzipped to a 30.6mb file with both 'Optimal, and 'Fastest compression. That does make me question the efficiency of Gzip in .NET. Alternatively, one could launch an external process and wait for the command to finish. And suddenly, one can easily switch out the ZIP and try an ARJ, or a LHArc
BillWoodruff wrote: I feel I should write up a Tip-Trick for CP. Please do
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: Alternatively, one could launch an external process and wait forthe command to finish. And suddenly, one can easily switch out the ZIP and try an ARJ, or a LHArc I have thought about experimenting with launching something like 7-Zip via Process.Start, as suggested (but never detailed) on the 7-Zip discussion forums, but I wonder if, in using any externally launched process, the (possibly required) transfer of the stream to be compressed, or the creation of a "temp" file to hold the stream, before invoking the external process' facilities, would add an "overhead" that would negate its benefit.
I have SharpCompress, found here on CodeProject [^], working, but am not seeing any radical improvement in the current test case over .NET's built-in GZip.
Yesterday I spent a few hours trying to get SharpZipLib [^] working in VS 2012, FrameWork 4.5, without success. But, I'll try that again today.
thanks, again, Bill
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
modified 19-Jul-13 1:10am.
|
|
|
|
|
BillWoodruff wrote: would add an "overhead" that would negate its benefit. To answer that, one needs to investigate both overhead and benefit. Yes, it does introduce a slight overhead - but not very much if you hide the console-window. Consider it an isolated, switchable, heavyweight instance of a thread.
BillWoodruff wrote: SharpCompress, SharpZipLib Let's also add DotNetZip[^]. And LZMA[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
See http://www.virtualdub.org/blog/pivot/entry.php?id=335[^] for how much it sucks.
There are various 3rd party deflate libs that suck less, I recommend SharpZipLib (nice license, too).
Though personally I recommend not using the built-in serialization in the first place and just dumping your raw data in a stream. It's a little more work up-front, but it's more flexible, a lot faster, and your data format will actually make sense (which is not always important of course). You can still put it through Deflate of course, I tend to do that (easier than explicitly storing sparse arrays and such).
|
|
|
|
|
That's an excellent analysis of GZip's limitations, in the article you cite, on virtualdub.com !
As I just commented to Eddy (post above): "Yesterday I spent a few hours trying to get SharpZipLib working in VS 2012, FrameWork 4.5, without success. But, I'll try that again today."
thanks, Bill
~
“This isn't right; this isn't even wrong." Wolfgang Pauli, commenting on a physics paper submitted for a journal
|
|
|
|
|
GZip Stream writes information to the stream after it is "closed" when creating the compressed zip stream. Do not wrap your compression in the using block. Call flush before closing out the stream when compressing. Then your decompress code may work.
|
|
|
|
|
Thanks, Ennis, I was aware of that issue, and in the OP, I cited a response on StackOverFlow:
"I've already learned the hard way that there is a quirk in using GZip in .NET in compressing [^]:"
That post cites a Microsoft BCL blog: [^].
yours, Bill
“This isn't right. This isn't even wrong." Wolfgang Pauli
|
|
|
|
|
How can I select flash textbox, past text, and click button in C# WebBrowser?
TextBox and Button: s7.postimg.org/oh2w84js7/button.jpg
Form where button is:
<form name="working" action="object_do.php" method="POST"><br><table class="wb" width="100%"><tbody><tr><td class="wbwhite" align="center" colspan="2">blahblahblah</td></tr><tr><td class="wb" width="140"><img src="work_codes/15903-34/1701507--381682.jpeg" width="250" height="60" border="0" name="imgcode"></td><td class="wblight" valign="center" width="100%"> <input type="hidden" size="4" name="code" autocomplete="off"><input type="hidden" value="5" name="id"><input type="hidden" value="5" name="id2"><script type="text/javascript">swfobject.registerObject("2e7f13a242369aa0a133ee3dced5bf5d", "9.0.0", "http://***/swffiles/expressInstall.swf");</script>
<div>
<object id="2e7f13a242369aa0a133ee3dced5bf5d" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="147" height="22" style="visibility: visible;">
<param name="movie" value="swffiles/459017015079176508wworkcode.swf?ver=1701507bf3d40fb076319ff7e6c2fc7a4898acdd88">
<param name="FlashVars" value="params=1701507|5|f3d40fb076319ff7e6c2fc7a4898acdd|">
<param name="bgcolor" value="#f5f3ea">
<param name="allowScriptAccess" value="always"><param name="wmode" value="opaque"><!--
BUTTON AND TEXT BOX-----------> <object type="application/x-shockwave-flash" data="swffiles/459017015079176508wworkcode.swf?ver=1701507bf3d40fb076319ff7e6c2fc7a4898acdd88" width="147" height="22">
<param name="FlashVars" value="params=1701507|5|f3d40fb076319ff7e6c2fc7a4898acdd|">
<param name="bgcolor" value="#f5f3ea">
<param name="allowScriptAccess" value="always"><param name="wmode" value="opaque"><!--
<div>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"></a></p>
</div>
<!--
</object>
<!--
</object>
</div></td></tr><tr><td class="wblight" colspan="2"><br> blahblahblah "blah".</td></tr></tbody></table></form>
|
|
|
|
|
it is inconceivable copying from flash file because it is compiled and how you want do that?
it's my opinion
-Amir Mohammad Nasrollahi
/* LIFE RUNS ON CODE */
|
|
|
|
|
|
I fail to understand the reason behind that requirement. Adobe Acrobat reader is available for many browsers (perhaps no more supporting extremely outdated legacy browsers like IE6 or NetScape 4) on many platforms - even Linux. And most browsers are already configured to use that. Why do you insist on soemthing different?
|
|
|
|
|
good
/* LIFE RUNS ON CODE */
|
|
|
|
|
as what "Bernhard Hiller" says adobe acrobat is free and suported by many browsers but from your selections list, verypdf can be better because of prices and good support (tasted by one of my friends)
/* LIFE RUNS ON CODE */
|
|
|
|
|