C#Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
//work on 1 cell
this.UneCellule=(Excel.Range)this.Cellules[XListe,YListe];
//value inserted
this.UneCellule.Value=this.ListeTypesCarte[i];
//cell border
this.UneCellule.BorderAround(Excel.XlLineStyle.xlC ontinuous,Excel.XlBorderWeight.xlThin,Excel.XlColo rIndex.xlColorIndexAutomatic,1);
//font style
this.UneCellule.Font.Bold=true;
//background color
this.UneCellule.Interior.Color=16777164;
//work on 2 cells
//insert values on first cell
this.Cellules[X,1]=rs.GetString(0);
//get cells
this.DeuxCellules = (Excel.Range)this.feuilleExcel.get_Range(this.Cell ules[X,1],this.Cellules[X,2]);
//cell border
this.DeuxCellules.BorderAround(Excel.XlLineStyle.x lContinuous,Excel.XlBorderWeight.xlThin,Excel.XlCo lorIndex.xlColorIndexAutomatic,1);
//background color
this.DeuxCellules.Interior.Color=10092543;
//font style
this.DeuxCellules.Font.Bold=true;
***********************************
EXCEL CLASS
***********************************
using System;
using System.Reflection;
namespace ControlOffice
{
public class ExcelApplication
{
public Excel.Application __Excel; // Application est une interface
public object opt= Missing.Value;
public string f;
public ExcelApplication(string fich)
{
//
// TODO : ajoutez ici la logique du constructeur
//
__Excel=new Excel.ApplicationClass();
__Excel.Workbooks.Open(fich,opt,opt,opt,opt,opt,op t,opt,opt,opt,opt,opt, opt);
f =fich;
}
public bool Visible
{
get
{
return __Excel.Visible;
}
set
{
__Excel.Visible=value;
}
}
public Excel.Workbook nomClasseur
{
get
{
return __Excel.ActiveWorkbook;
}
}
public Excel.Worksheet nomFeuil
{
get
{
return (Excel.Worksheet) __Excel.ActiveWorkbook.ActiveSheet;
}
}
Formatting a excel cell programtically in asp.net c#
I put this way but there is an syntax error: newSheet.Cells[i + 2, 3] = drugorder.DATE; HorizontalAlignment == ExcelAlignment.xlLeft; Error 2 'System.Windows.Forms.HorizontalAlignment' is a 'type' but is used like a 'variable' C:\ADL\ExcelReader\ExcelReader\Form1.cs 257 68 ExcelReader Error 3 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\ADL\ExcelReader\ExcelReader\Form1.cs 257 68 ExcelReader