|
Yes, thank you.
Maybe there is something wrong with my xml string format
|
|
|
|
|
taibc wrote: I have a excel with the size is: 500KB
But, after opening it and click "save" button without changes, the new size is: 2.5MB
It's by design. XML is exactly that; XML, not a XLS file. If you open it in Excell, it'll parse it correctly. But save it in Excell, and it'll generate an Excell-file (.xls), and not write in your XML-format.
You might want to use a CSV file instead.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy,
Thank you.
So, I can save xml string as "CSV" file ? But, I am wanting to creat .xls file from xml string.
Do you have any ideas ?
|
|
|
|
|
taibc wrote: But, I am wanting to creat .xls file from xml string.
XML is not a native Excell-format. Creating an .xls file is not the same as dumping your data as Xml and renaming the extension - it will still be XML (even if Excell can read it without problems) and as soon as you save it, it will become a "real" XLS-file. That will contain more than Xml, as it will contain even properties that identify the author.
taibc wrote: So, I can save xml string as "CSV" file ? <layer>But, I am wanting to creat .xls file from xml string.
CSV would behave in a similar way, but at least it'd be very clear that it's no longer an Excell-file
If you want a "real" Excell file (the large ones), you'll need to create a file using Excel-interop and move the Xml values into a worksheet.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thank you ,
How can I move Xml values (xml string) into a worksheet ?
|
|
|
|
|
As Richard notes, if you want to write a file in the native Excell-format, you'll have to InterOp to Excell. One problem to be expected is that the interop-libraries are tied to a specific version of Office. Use Office-2007 interop, and you'll be able to write .xls and .xlsx files. Do note that the native format is also tied to a specific Office-version. Second point is that one would need a license for Excell.
Alternatively, you could try searching for some third-party libraries. Most people will spit out an XML or CSV and not bother with it, unless there's a need to have some formatting in there.
Why is it such a big problem if the file grows a bit?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks Eddy,
I had a solution for this. I used Interop.Excel to open the file and Save as a normal workbook, and the result is ok (the size is smaller, and don't have any problems).
Thanks and regards,
|
|
|
|
|
The default "SaveAs" option in this spreadsheet is to save as XML Spreadsheet, which is text, and therefore takes much more space on disk. Save it as Excel Workbook and it is the same size.
Use the best guess
|
|
|
|
|
Hi Richard,
I used "Save" button (not SaveAs), but the size is bigger after saving
|
|
|
|
|
Yes, and it is because the default format for saving this file is XML Spreadsheet, as I mentioned above. If you open that file with a text editor you will see that it is an XML file. You need to use SaveAs to change the default to Excel Workbook.
Use the best guess
|
|
|
|
|
Oh, you are right.
How can I save this file to Excel Workbook using C# ? So, users only need to open and save it (not save as)
I used below codes to save xml string as .xls file.
<pre lang="c#">
FileStream fs = File.Open(path, FileMode.Create, FileAccess.Write);
StreamWriter stmWriter = new StreamWriter(fs, System.Text.Encoding.UTF8);
stmWriter.Write(strXMLContent);
Thanks and regards,
Tai
|
|
|
|
|
|
Before, I tried to use Interop.Excel but, It is quite slow to create file.
So I used StreamWriter to write xml string, and it is more quickly.
Is it possible to use Interop.Excel to create excel file from XML String ?
Are there any otherway ?
Thanks and regards,
Tai
|
|
|
|
|
Fine, but what you end up with is an XML Spreadsheet, not an Excel Workbook. You need to decide which is best for your application.
Use the best guess
|
|
|
|
|
Ok, thank you for your help
|
|
|
|
|
in my example it's show that I put only one marker but lets say I add much more markers and I only want to remove marker in my array in index 0.
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox1.Checked == true)
{
GMap1.addGMarker(markers1[0]);
}
else
{
}
}
modified 6-Apr-13 17:51pm.
|
|
|
|
|
Hi Guys,
Do you have any idea on how to automate website using c# windows form? If so, can you provide me. I am a new bee in automation and I want to automate my testing in the website.
Thanks,
Nico
|
|
|
|
|
Create a new project, throw a WebBrowser component on there, and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.navigate.aspx">Navigate</a>[<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.navigate.aspx" target="_blank" title="New Window">^</a>] where you want.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi everyone, I have a problem, we borrow our clients laptops in our company for a short time. Users should be the local admin of the computer in order to add/remove programs they need. However, some of them didn't return the laptops in time so, we decided to write a program that locks the computer on date that we give before. I have one windows service, one form application which interacts with user and communicates with the service. While I testing, when I kill my program or my service, I give bsod but, when I try to disable the service and restart my computer, it doesn't run anymore. I need a method to prevent disable my service. Even my form application gets killed, my service has to run in background. Thanks.
|
|
|
|
|
candogu wrote: we borrow our clients laptops in our company for a short time
Presumably you mean that you lend them to your clients.
candogu wrote: we decided to write a program that locks the computer on date that we give
before
Seems like an unlikely and complicated solution. Why don't you just send them a bill, with an appropriate markup, as the replacement cost of the computer? The markup should be high enough that it allows you to buy a new computer and cover collection agency costs. Presumably the clients are in fact capabable of covering that cost or you shouldn't be lending it to them in the first place.
candogu wrote: I need a method to prevent disable my service
I am rather certain that is impossible. You can however make it difficult.
But really will this fix your problem? Are you sure the clients will return the computer then? What stops them from just throwing it in the trash?
|
|
|
|
|
I'd boot in safe mode and install my own "fun.exe" before returning it to you
While there's few valid reasons to be late in returning the laptop, there's none in locking it. You have a list of people whom you lent it to; send them a mail and charge them a small fee for each day that it's not returned.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Since everyone is an admin, you can't, really.
|
|
|
|
|
ThePhantomUpvoter is that ur account
|
|
|
|
|
I think I speak for everyone when I say "What?"
|
|
|
|
|
I think this may be an exercise in redundancy.
He is asking everyone if the ThePhantomUpvoter account is your account, but there is only one account that can answer this, ThePhantomUpvoter. A bit like asking all the integers if they are the number 17. The question might even have deep existentialist qualities, but if it does, I've failed to discern them.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|