|
Hi,
I have an excel file that contains a chart, is there a way using C# code to take that chart in the excel file and export it to an image file.
Before I was making the chart in the C# code and was able to export it but now the chart is already made.
Thanks in advance.
|
|
|
|
|
Did you checked workbook.charts property? I think it gives collection of the sheets with charts.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
modified on Tuesday, January 6, 2009 1:18 AM
|
|
|
|
|
Hi,
Can anyone please tell me how can I get how do I get user's local time . I am using asp.net ,C#. If i have to use small javascript that would be okay.
Thanks for any comments or idea.
|
|
|
|
|
Yes, you need to use Javascript. Create a Date object to get the current time, use the getTime method to get the date as an integer value, and put the value in a hidden field. Read the value when it's posted to the server and convert it to a DateTime value.
Hidden field:
<input type="hidden" id="ClientTime" name="ClientTime" />
Javascript code:
document.getElementById('ClientTime').value = new Date().getTime();
Server code:
string milliseconds = Request.Form["ClientTime"];
DateTime clientTime;
if (string.IsNullOrEmpty(milliseconds)) {
clientTime = DateTime.Now;
} else {
clientTime = new DateTime(1970,1,1).AddMilliseconds((double)long.Parse(milliseconds));
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thank for your reply. Here is what i tried.But i get NULL value when I tried at the backend.
1st:
function GetClientUtcOffset()
{
document.getElementById('ClientTime').value = new Date().getTime();
}
2nd:
onload="GetClientUtcOffset();">
3rd:
input type="hidden" id="ClientTime" name="ClientTime" />
FinallY:
string milliseconds = Request.Form["ClientTime"]; // I get milleseconds = null
DateTime clientTime;
if (string.IsNullOrEmpty(milliseconds)) { clientTime = DateTime.Now; }
else { clientTime = new DateTime(1970, 1, 1).AddMilliseconds((double)long.Parse(milliseconds)); }
Thanks for any comments or help.
|
|
|
|
|
Yes, you will always get a null value until you have posted the form to server. First the script has to run on the client side, then you can get the value on the next postback.
Also, make sure that the hidden field is inside the form that is posted.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks for your reply.
How do I make sure the hidden field is posted ? I am always getting null even after psotback.
--- Also I am running at the body's onload. So shouldn't it run as soon as the page load?I am not sure -- just curious .. since it's not working.
Thanks
|
|
|
|
|
This is not the ASP.NET forum. If you can't follow some simple instructions, or read one of the many google articles on how to do this, at least ask in the right forum.
mdpavel wrote: Also I am running at the body's onload. So shouldn't it run as soon as the page load?I am not sure -- just curious .. since it's not working.
It seems you have no idea how ASP.NET works. OnLoad and OnPreRender run on the server, obviously, they need to run to completion for HTML to be sent to the client. So, there is no code on the client until a postback occurs, until then, there's no way to know what the time on the client is.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hey Christian Graus,
You don't need to be an A**HOLE.. If you don't want to reply don't. I didn't even ask you. So next time saying something like this why don't u just shut the f**K off.
|
|
|
|
|
|
Me too
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
|
|
|
|
|
|
mdpavel wrote: How do I make sure the hidden field is posted ? I am always getting null even after psotback.
Then your field is not in the form that is posted. Either you put the field in the wrong place of the page, or you are not doing a postback at all.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
lets say i have a dll which relies on nhibernate or log4net. And within this dll there're calls which references these external library (nhibernate/log4net .. etc).
To be specific, and as an example I may have a config file look like this:
<configuration>
<configsections>
<sectiongroup name="spring">
<section name="context">
type ="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects">
type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</section></section></sectiongroup>
<section name="nhibernate">
type="System.Configuration.NameValueSectionHandler, System,
Version=1.0.5000.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
<section name="log4net">
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</section></section></configsections>
<spring>
<context><resource uri="config://spring/objects" /></context>
<objects>
</objects>
</spring>
<nhibernate>
... nhibernate config ...
</nhibernate>
<log4net>
... log4net config ...
</log4net>
</configuration>
Now where should I put app config for log4net or nhibernate. In the application's app.config or in dll's app.config?
I want avoid having to copy config setting when I reference my DLL from a console app this time, then next time to a ASPNET or WebService. Each time having to merge/cut/paste app.config (from Dll) seems like a waste of time.
Thanks
dev
modified on Thursday, January 8, 2009 8:50 AM
|
|
|
|
|
In the publish tab of the properties there is a prerequisites where you can put this, it then ends up in the app.config I beleive.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sorry I open "Properties" of my dll project - I don't see any publish tab there? I do see there's a "Publish" tab under "Properties" of the console app (which references my Util dll project). I'm not sure what you're getting at though...
And my confusion really arise from:
MyConsoleApp.exe's app.config
vs
MyDll's app.config
Where should I put nhibernate/log4net config - obviously, since my nhibernate/log4net code in dll, not the console app. I therefore would prefer config be placed in App.Config of the dll, not the console app.
dev
|
|
|
|
|
I'm creating a game and I need to rotate this object. Ok i'll make my explanation simple, I have Object1 and Object2.. Let's say Object1 is at coordinates 0,0 (x,y) and Object 2 is at coordinates 10,10... Object 1 is currently facing south, Now I need object 1 to be facing Object 2 so I need the "degree" value from object 1 to object 2. Does anyone have a math formula for getting the degree? or an alternative solution can help.
|
|
|
|
|
Hi,
imagine a rectangular triangle with your two points on the hypotenuse, and the two perpendicular sides parallel to the axes. The angles you want have tangent or cotangent
equal to deltaY/deltaX, so you need something similar to Math.Atan2(deltaY,deltaX) .
However, are you sure you need the angle? Trigonometric functions are rather expensive,
and a lot of graphic stuff does not need them after all, often something much simpler
can do the trick as in Math.Sqrt(deltaX*deltaX+deltaY*deltaY) for the distance, and
similar stuff for projections and stuff.
|
|
|
|
|
Luc Pattyn wrote: imagine a rectangular triangle
I'm trying - really I am.
If I knew then what I know today, then I'd know the same now as I did then - then what would be the point?
.\\axxx
(That's an 'M')
|
|
|
|
|
|
How to read special characters such as <,> in XML document in C#. I am passing sql statement from xml file to my c# program. SQL statement contain >,< characters. Please tell me a way escape these characters.
Dushan Perera
|
|
|
|
|
|
It's Not working
Dushan Perera
|
|
|
|
|
Then you are doing it wrong.
How are you creating the XML document?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi everyone
so this is my problem, i have a windows forms proyect, the first form calls the second and that last one is a gui like an agenda, its connected with sqlite (i think this is irrelevant but i just wanted to mention it) the contacts are sorted in a treeview and if i makes changes in one contact, like names or telephone if i click on another contact the program asks if i want to save changes
now here is my problem
sometimes i change the name or something and then when i click on another contact and i choose to save the changes the program will call Dispose method for no reason and shut down, this error has also happened when i choose to NOT save changes, and when i do save them , i look in my database and it DOES save them! debugging my program i noticed that whenever this thing happens it gives me a NullReferenceException, you know the "object reference not set to an instance of an object"
this thing only happens SOMETIMES, for no aparent reason do you have any ideas why is this and how i could fix it?
thanks a lot in advance guys
|
|
|
|