|
I have opened the file its not Corrupt. i even installed the Service Pack1 for Office and now what is on the server version is now equal to the one on my machine.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
The KB article lists several things that you need to check on the server. However, there is no guarantee that you will be able to get your code to work, or that it won't suddenly stop working for no obvious reason.
You might have better luck using the Open Office XML SDK to generate your documents:
Creating Documents by Using the Open XML Format SDK Version 2.0 CTP (Part 1 of 3)[^]
(Part 2 of 3)[^]
(Part 3 of 3)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
We're going to start with you cannot run any Office application in a service and expect it to work. It's not supported, never has been, never will be. This means you can NOT use Office Interop in your service application.
You're going to need the OpenXML SDK to manipulate Office files. So now, what were you trying to do with this document once you had it open?
modified 23-Jun-15 10:51am.
|
|
|
|
|
hi Dave Long time.
Let us start here, i have a few applications that does the MailMerge Automatically but on a click of a button. The strange this is when test the service on my machine it works , the problem is when i deploy it its a problem. i have added some log files which actually pointed to the line of code
oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
Here its where i give word the Template it will use in my mail merge , i have the same code working nice in a Non-Windows Service and also on my debug on my laptop it works with no Problem.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
Vimalsoft(Pty) Ltd wrote: Here its where i give word the Template it will use in my mail merge , i have the same code working nice in a Non-Windows Service and also on my debug on my laptop it works with no Problem.
You don't understand what you're doing and what's going on. It works in your dev and testing because you're not running the code AS A SERVICE.
When you deploy the code and run it as a service, it falls on its face.
I don't know how much clearer I can be. <insert any="" office="" app="" here=""> CAN NOT BE USED IN A WINDOWS SERVICE. IT WILL NOT WORK.
What everyone is telling you is that you cannot do this as a Windows Service application. Period.
|
|
|
|
|
You have a license for Word that allows you to do this? Install it on a server and have it automated by "n" clients via a service? Must have been expensive....
|
|
|
|
|
No , i don't think one will need license for that. Because you just need to install Word and use its Component to automate Mail Merging.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
Well....I think Microsoft might disagree with you, why don't you contact their licensing department and ask? Tell them you've bought a single copy of Word that you're installing on a server so that hundreds\thousands of people can all use it remotely.
|
|
|
|
|
No one is using it remotely. Basically my serve get a Template document and get data from the DB and generate the word Document on the server. No one is accessing those documents except one person who is actually posting those documents.
i have now went the nasty to get my department working. So i have copied the same code in a Windows form application and created Schedule that will call that exe every 10 min. i will need to monitor that and see how it works for few days.
For now i think this case is closed.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
Hello guys, I have below code & I would like to combine into one method that accept generic type... possible to do that?
Thanks.
public string empName
{
get
{
object temp_result = func1(MyConst.name);
string result = Convert.ToString( temp_result );
return result;
}
}
public int empID
{
get
{
object temp_result = func1(MyConst.id);
int result = Convert.ToUInt16( temp_result );
return result;
}
}
public object empData
{
get
{
object temp_result = func1(MyConst.Data);
object result = temp_result;
return result;
}
}
modified 23-Jun-15 3:14am.
|
|
|
|
|
Do you mean "how do I write a generic function I can call from all the properties?"
If so, what's the problem?
private T func1( T param)
{
...
}
If not, then what do you mean?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
I want to populate a label in an Access report header, from C# using automation. The report has the following in the Load event:
Option Compare Database
Private Sub Report_Load()
Me.lblHeaderReport.Caption = Me.OpenArgs
End Sub The C# source code:
using MsAccess = Microsoft.Office.Interop.Access;
MsAccess.Application app = new MsAccess.Application();
app.OpenCurrentDatabase(
"C:\\Dev\\Databases\\SomeDatabase.mdb",
false,
"some password"
);
string strFilter = "qSomeQueryForReport";
app.Visible = false;
app.DoCmd.OpenReport(
"rptSomeReport",
Microsoft.Office.Interop.Access.AcView.acViewNormal,
strFilter,
Type.Missing,
MsAccess.AcWindowMode.acWindowNormal,
"HeaderTest"
);
app.DoCmd.Close(
MsAccess.AcObjectType.acReport,
"rptSomeReport",
MsAccess.AcCloseSave.acSaveNo
);
app.CloseCurrentDatabase();
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
app = null; Problem:
The text "HeaderTest" does not appear in the report header label. No error generated.
modified 23-Jun-15 4:08am.
|
|
|
|
|
I have program but I don't understand about source code to open some file.. Anybody help me? How to open from excel or notepad and it read on our program?
|
|
|
|
|
Sorry?
I'm not sure I understand you correctly: it sounds like you have the source code to a C# program and want to look at it, modify it, and then compile and run the result.
If so, then Excel and Notepad are both bad choices!
Go to Microsoft, and download a copy of Visual Studio (there are Express version of 2005, 2008, 2010, 2012, and a Community Edition version of 2013 - all of which are free, subject to certain conditions)
Which version you need depends on how old the source code is: you are probably best assuming you want the latest version: https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx[^]
When that's installed, double click the .SLN file that should be part of the source code and the project should open.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Can I use javascript in web forms project which has master pages and content pages. I know it can be used but the code written in script tag or style tag is not executed. I have tried too many solutions I get from sites like stakoverflow and codeproject because I am facing this problem since 15-20 days, even there is no error in the syntax. But the problem is script is not executed.
|
|
|
|
|
A couple of things.
1. This is the C# forum, so you're not going to have much luck here.
2. You haven't shown any code. No one will be able to help you identify a problem with your code if you haven't shown it.
|
|
|
|
|
Your problem is that you're not appreciating that javascript runs on the client using the rendered html, and what you see in visual studio aspx files is not what is rendered to the client. .net will change your control IDs so if you refer to IDs in your js you need to use the ClientID property of the control to get the proper ID, or use static ids if that is suitable (it won't always be);
ASP.NET 4.0 Client ID Feature[^]
Other things you need to bear in mind are code paths and how you refer to your js files in relation to your other files.
There is no single trick to this, it mainly involves having a good understanding of the framework and using best practises in your coding, and tackling individual problems as you encounter them.
|
|
|
|
|
1st and foremost, I've got lots of time to develop this. So, I'd like to try to do this the right way… As much as possible, the 1st time through.
I know I'm going to need to utilize the array class, what other classes/functions/methods would I need to utilize?
I also know I'm going to need a database of words and phrases, still haven't decided if I want to use MySQL or XML to house my database of words and phrases. I'll most likely scrape a few online Thesauruses and Dictionaries to initially populate my database. That in itself, is a whole project on its own.
Anyway, I could see using "if, if then, arrays and the database". While mixing in the random class. I was just wondering if any of you old pros could see any other classes or methods in the .Net framework that could be utilized in a project like this.
I'm not looking for code snippets, just some overall suggestions on what possibly to use and what not to use and possibly what to look out for.
I want to try to write down my blueprint/game plan before I even think about writing any code.
Suggestions, ideas, feedback is all appreciated in advance!
|
|
|
|
|
I am stumped
I have to convert a function, which I think is in "SAS" to a c# equivalent...
This is the function:
remaining_payment=(36-ms_since_issue)*(out_prncp*(t_int_rate/12*(1+t_int_rate/12)**(36-ms_since_issue)))/((1+t_int_rate/12)**(36-ms_since_issue)-1);
I cannot work out what the ** mean in the function.
Can anyone see what is trying to be done and what the equivalent c# version might be please?
Thanks
Trev
|
|
|
|
|
|
According to the documentation[^], ** is the exponentiation operator.
The C# equivalent would be the Math.Pow function[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i need to change my start up page in c#
|
|
|
|
|
C#? VB? Form? Page? Change? Change what? What have you tried and where's the problem?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Not enough information.
What kind of project? ASP.NET? Windows Forms? WPF?
Which language? C# or VB.NET?
|
|
|
|