Hi. Here's what i have done: -
using System;
-
using System.Collections;
-
using System.Reflection; // For Missing.Value and BindingFlags
-
using System.Runtime.InteropServices; // For COMException
-
using Excel = Microsoft.Office.Interop.Excel;
-
-
namespace MSExcelApp
-
{
-
/// <summary>
-
/// Summary description for ExcelAuto.
-
/// </summary>
-
public class ExcelAuto
-
{
-
private Excel.Application ExcelApp;
-
private Excel.Workbook objBook;
-
private Excel.Worksheet objSheet;
-
private Excel.Range range;
-
string strAttendeeList, strAbsenteeList, strCopiesToList;
-
int totActionItems;
-
object oMissing, oTemplate;
-
private string strTitle;
-
-
public ExcelAuto()
-
{
-
//
-
// TODO: Add constructor logic here
-
//
-
}
-
public void CreateFile(ArrayList array)
-
{
-
object missing = System.Reflection.Missing.Value;
-
object fileName = "normal.dot";
-
object newTemplate = false;
-
object docType = 0;
-
object isVisible = true;
-
-
ExcelApp = new Excel.ApplicationClass();
-
ExcelApp.Visible = true;
-
objBook = ExcelApp.Workbooks.Add(missing);
-
objSheet = (Excel.Worksheet)objBook.Sheets["Sheet1"];
-
objSheet.Name = "It's Me";
-
-
objSheet.Cells[1, 1] = "Details";
-
objSheet.Cells[2, 1] = "Voltage : "+ array[0].ToString();
-
objSheet.Cells[3, 1] = "EmployeeID : "+ array[1].ToString();
-
-
objSheet.get_Range("A1", "A1").Font.Bold = true;
-
objSheet.get_Range("A1", "A6").EntireColumn.AutoFit();
-
objSheet.get_Range("A1","A7").BorderAround(Excel.XlLineStyle.xlContinuous,Excel.XlBorderWeight.xlMedium,
-
Excel.XlColorIndex.xlColorIndexAutomatic,Excel.XlColorIndex.xlColorIndexAutomatic);
-
}
-
-
static void Main()
-
{
-
Application.Run(new Form1());
-
}
-
-
private void btnCreate_Click(object sender, System.EventArgs e)
-
{
-
ExcelAuto excel = new ExcelAuto();
-
ArrayList array = new ArrayList();
-
bool filled = true;
-
-
if ( ( 1.016).ToString().Length.Equals(0) )
-
{
-
errorProvider.SetError(1.016,"cannot be empty" );
-
filled = false;
-
}
-
if( ( 00180000 ).ToString().Length.Equals(0) )
-
{
-
errorProvider.SetError( 00180000,"cannot be empty" );
-
filled = false;
-
}
-
-
-
if ( filled == true )
-
{
-
array.Insert(0,1.016);
-
array.Insert(1,00180000);
-
-
-
excel.CreateFile(array);
-
}
-
}
-
-
private void button2_Click(object sender, System.EventArgs e)
-
{
-
Application.Exit();
-
}
-
}
-
}
-
-
I have to convert the data of voltage and employeeeID, 1.016 and 00180000 respectively to be displayed in excel. It has to be in console. Can you please check the code. There's some errors but i don't know how to mend them. Thanks.
4 2030 tlhintoq 3,525
Recognized Expert Specialist
There's some errors but i don't know how to mend them. Thanks.
Help the volunteers to help you: What are the errors and on what line #'s?
Line 65: Class, struct, or interface method must have a return type
Line 133: Type or namespace definition, or end-of-file expected
All I need is to display the data in excel. It has to be in console not windows application. Thanks.
tlhintoq 3,525
Recognized Expert Specialist
Line 65: Class, struct, or interface method must have a return type
Line 133: Type or namespace definition, or end-of-file expected
You don't have 133 lines of code here. There are only 93 if you count the last to blank lines.
the last one refers to the curly braces at the end. I dont know whats wrong there.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: gonzlobo |
last post by:
No, I don't want to destroy them (funny how the word 'decimate' has
changed definition over the years) :).
We have a data acquisition program that saves its output to Excel's
..xls format. Unfortunately, the programmer was too stupid to write
files the average user can read.
I'd like some advice on how to go about:
1. Reading a large Excel file and chop it into many Excel files (with
only 65535 lines per file)
|
by: thought.contagion |
last post by:
I need to determine if Excel 2007 is installed.
For Office 2003, we had the component ID for Excel 2003 and could use
the msi.dll to enumerate and that would tell us if it was installed:
iRet = MsiGetComponentPath(sProductCode.Trim, sComponentID, sPath,
iLen)
sProductCode is the Office 2003 Product Code, sComponentID is the
Excel 2003 component ID. sPath would hold the path to excel.exe.
|
by: silverear |
last post by:
Hello everybody,
I have written an application that is running as an Office project
within Excel in C#. I created a setup project for my tool. When I
install my program on a machine that has Excel 2003 everything is
fine. If there is only Excel 2007 the installation will fail. If there
are both (Excel 2003 and 2007) installed, the installation is also ok.
My tool is running fine with Excel 2007, but I can't install it on a
machine...
|
by: Ch Pravin |
last post by:
Hi All:
I am having the following xml which i need to convert to excel using xslt.
Please help me out.
Afghanistan.xml
<?xml version="1.0" encoding="utf-16"?>
<Languages BuildVersion="1,5,0815,0 " CountryName="Afghanistan" >
<Language locale="English">
|
by: cloh |
last post by:
I have a form in Access that generates an Excel Workbook with multiple worksheets. Each worksheet is unique to a particular location. The top row of each sheet shows the dates, the left-most column has the times of the day in 5 minute intervals. Let's say the dates range from 7/01/2007 to 9/01/2007
The aim of the form is to eventually create a chart for each date that the user wants. On the form, I get the user to input either a single date...
| |
by: =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= |
last post by:
Hi All,
We are in the process of Upgrade Excel 2003 (Office 2003) to Excel 2007
(Office 2007) for one of web application.
This web application is using Excel (Pivot Table) reports. With Excel 2003
application (Reports) works ok.
But when Office 2003 is upgraded to Office 2007 Excel reports stops working.
It Log the error “Exception from HRESULT: 0x800A03EC.” In database.
|
by: mwilliams4 |
last post by:
I have an Access 2003 table that I want to generate into tabbed Excel
2003 workbooks using a button on a form.
The tables would need to overwrite everytime that the button would be
pressed.
Table name: Datatable (data)
Field1: Customer (Bob, Dan, Joe)
Field2: Model (Ace, Cat, San)
Field3: YrMo (2007-01, 2007-02, 2007-03)
|
by: budigila |
last post by:
Hiya peeps,
Okies, I have been trying to work this out for a while now to no avail... I am a beginner to this whole coding thing but have made great strides in my project. Basically what I am trying to do is to convert an .xml using a .xsl to and using a java script to output it into a readable format within excel. I have been able to successfully use a javascript to combine my .xml and .xsl but cannot figure out how to have it output to...
|
by: chuch0117291 |
last post by:
Hi, i have a form with the main details of a vendor and and contract description and a budget reference(PK). Within this form, i have a sub form which includes cost details for that specific vendor but also has the same budget reference hence the link. I would like to create a command button to be able to export the data from the main form to an excel spreadsheet and the data from the sub form to excel spreadsheet tab2 from the click of a...
|
by: Ted Theo |
last post by:
hello cdma enthusiasts. long time no speak. i have an .adp which is
connected to a sql 2k back end from which i need to export a table to
a tab delimited text file. the export text wizard apparently doesn't
allow you to store export specs (makes sense since it has no local
storage) so i'm not sure the TransferText method is going to do the
trick. i need to do this in VBA. any suggestions?
it's been a while since i've been active in...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |