473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Working via the Application folder

Hi,

I have a C# .net application.

In this application, the user clicks on a button to generate an excel
file. I save the macros which compose this generate file within an
excel template file. Therefore when generating the excel file, I need
to read from this template.

As a result, I need the path to this template file from within my
application -

app = new Excel.Application();

workbook = app.Workbooks.Open(@"templateFolder + "\Book1.xlt",
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);

I have added a setup project to my solution, and via this I have added
the template to the Application Folder (under File System). In other
words, this template will be installed into the application folder for
the user in question.

Problem is, how do I handle this when I'm debugging my application and
I don't neccessary have an "Application Folder".

Thanks for your help,

Barry.
Aug 13 '08 #1
3 1325
Hi Barry,

C/C++ has preprocessor directives that you could check from within your
code, but I don't know if C# includes these or what they would be called.

In C/C++, you'd write something like:
#ifdef DEBUG
appFolder = m_DebugFolder;
#else
appFolder = m_ApplicationFolder;
#endif

I know this doesn't solve your problem, but maybe this could remind you of
something similar you've seen in C# that you could tell me of, or maybe this
will help someone else see what you are trying to accomplish, and I'm
personally curious to see the answer!

Keep me posted!

Regards,
Joe

"Ma*************@gmail.com" wrote:
Hi,

I have a C# .net application.

In this application, the user clicks on a button to generate an excel
file. I save the macros which compose this generate file within an
excel template file. Therefore when generating the excel file, I need
to read from this template.

As a result, I need the path to this template file from within my
application -

app = new Excel.Application();

workbook = app.Workbooks.Open(@"templateFolder + "\Book1.xlt",
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);

I have added a setup project to my solution, and via this I have added
the template to the Application Folder (under File System). In other
words, this template will be installed into the application folder for
the user in question.

Problem is, how do I handle this when I'm debugging my application and
I don't neccessary have an "Application Folder".

Thanks for your help,

Barry.
Aug 13 '08 #2
C# is basically the same except it is #if not #ifdef
#if

#else

#end if
"jp2msft" <jp*****@discussions.microsoft.comwrote in message
news:59**********************************@microsof t.com...
Hi Barry,

C/C++ has preprocessor directives that you could check from within your
code, but I don't know if C# includes these or what they would be called.

In C/C++, you'd write something like:
#ifdef DEBUG
appFolder = m_DebugFolder;
#else
appFolder = m_ApplicationFolder;
#endif

I know this doesn't solve your problem, but maybe this could remind you of
something similar you've seen in C# that you could tell me of, or maybe
this
will help someone else see what you are trying to accomplish, and I'm
personally curious to see the answer!

Keep me posted!

Regards,
Joe

"Ma*************@gmail.com" wrote:
>Hi,

I have a C# .net application.

In this application, the user clicks on a button to generate an excel
file. I save the macros which compose this generate file within an
excel template file. Therefore when generating the excel file, I need
to read from this template.

As a result, I need the path to this template file from within my
application -

app = new Excel.Application();

workbook = app.Workbooks.Open(@"templateFolder + "\Book1.xlt",
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);

I have added a setup project to my solution, and via this I have added
the template to the Application Folder (under File System). In other
words, this template will be installed into the application folder for
the user in question.

Problem is, how do I handle this when I'm debugging my application and
I don't neccessary have an "Application Folder".

Thanks for your help,

Barry.
Aug 13 '08 #3
On Aug 13, 4:37*pm, Magnus.Morab...@gmail.com wrote:
Hi,

I have a C# .net application.

In this application, the user clicks on a button to generate an excel
file. I save the macros which compose this generate file within an
excel template file. Therefore when generating the excel file, I need
to read from this template.

As a result, I need the path to this template file from within my
application -

app = new Excel.Application();

workbook = app.Workbooks.Open(@"templateFolder + "\Book1.xlt",
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);

I have added a setup project to my solution, and via this I have added
the template to the Application Folder (under File System). In other
words, this template will be installed into the application folder for
the user in question.
If your template is part of your VS project, you can change its "Copy
to Output Directory" property so that it is copied to the same folder
as your .exe when the project is built. If your application folder is
defined as the folder in which the .exe file is located, then you can
use this to enable debugging of this feature.
Aug 13 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: George Hester | last post by:
I put the following in the global.asa which is on the root of the web at the top of the asa file: <!--METADATA TYPE="typelib" UUID="EF53050B-882E-4776-B643-EDA472E8E3F2" NAME="ActiveX Data Objects...
1
by: Kelly | last post by:
hi all, it's me again. i'm using ASP.NET Web Application, using a "File Field"component under HTML tab and i do a right click on the component and select "Run As Server Control". This was done...
8
by: Hardy Wang | last post by:
Hi: Is it possible for me to create/open web application from remote machine other than port 80? And create application directly under virtual web site instead of creating a virtual directory?...
9
by: Roni Burd | last post by:
Hi!, I'm having a strange issue while deploying a web site with Validator controls. In my development machine the Validators function perfecly and also when I deploy using XCOPY to a web server....
4
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can...
3
by: abcd | last post by:
I have installed .net framework 1.1 when I create simpel Hello.aspx its not working I am using Windows XP SP2. I reinstalled .net framework by calling aspnet_regiis -i I get below message...
4
by: tshad | last post by:
I have a site www.stf.com and a site www.stfstage.com (where I do all my testing). The problem is that www.stfstage.com is only internal and I need to get access from the outside (without...
2
by: dev121 | last post by:
Hi all, I have attempted to create a vb.net application that can extract neccessary data from a xml file to txt format. This is all working fine. The next step for me is to be able to scan a...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine running IIS 6.0. I just replaced the web.config and several aspx pages in the application and now the style sheets are not working. the images from the themes work but not the css...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.