|
What about MEF[^]?
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Hi Amit, thanks for suggestion..i dont know much about MEF, But surely look into this direction as well..
|
|
|
|
|
Hi everyone,
I am creating XML spreadsheet in C# and save it as Excel file (.xls). After creating, 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
Are there anyone know why and how to fix it ?
Please see my excel file at the link: http://www.mediafire.com/?5irdbchc10nonq4[^]
Thanks and regards,
Tai
|
|
|
|
|
What makes you think this is a problem, you are expecting an xls file to be the same size as a text file!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi RAH,
The changing the size of file after saving the excel file is problem. It make the file slower when opening.
Thanks and regards,
|
|
|
|
|
taibc wrote: It make the file slower when opening
Amazing, imagine that. sorry sarcasm got the better of me.
To test the excel size why don't you copy/paste the data from your sheet to a new sheet, save it and compare the sizes. Only if the new file is not 2.5 mb do you have a problem.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Rah,
I did as your suggestion The new file is 200KB. I haven't known why ? Could you please open and check that file ?
Thanks and regards,
|
|
|
|
|
taibc wrote: Could you please open and check that file
Sorry I am not an excel expert, I suggest you chase this down through the MSDN forums as I would think it is an Excel problem not a c# issue.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
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
|
|
|
|