Пример #1
0
		public void addRow ( DataRow _dataRow, int _indexRow, bool isBold, int color )
		{
			try {

				InteropExcel.Range range;
				//Форматираме
				range = excel.Range ["A" + _indexRow.ToString(), "C" + _indexRow.ToString() ];

				if( color > 0 )	range.Interior.ColorIndex = color;
				if( isBold )	range.Font.Bold = isBold;

				//Въвеждане на данни клетка по клетка
				range = excel.Range ["A" + _indexRow.ToString(), "A" + _indexRow.ToString() ];
				range.Value2 = _dataRow.firstName;

				range = excel.Range ["B" + _indexRow.ToString(), "B" + _indexRow.ToString() ];
				range.Value2 = _dataRow.lastName;

				range = excel.Range ["C" + _indexRow.ToString(), "C" + _indexRow.ToString() ];
				range.Value2 = _dataRow.age;
				
			} catch {
			}

		}
Пример #2
0
		public void addRow(DataRow _row,int _indexRow,bool isBold, int color)
		{
			try {
				InteropExcel.Range range;
				//форматиране
				range=excel.Range["A"+_indexRow.ToString(),"C"+_indexRow.ToString()];
				if (color > 0) range.Interior.Color=color;
				range.Font.Bold=isBold;

				//Попълване на данните
				
				range=excel.Range["A"+_indexRow.ToString(),"A"+_indexRow.ToString()];
				range.Value2=_row.firstName;

				range=excel.Range["B"+_indexRow.ToString(),"B"+_indexRow.ToString()];
				range.Value2=_row.lastName;

				range=excel.Range["C"+_indexRow.ToString(),"C"+_indexRow.ToString()];
				range.Value2=_row.age;


			} catch {
			}

		}
		public void addRow(DataRow _row)
		{
			try {


			} catch {
			}
		}	
		public void addRow (DataRow _dataRow, int _indexRow, bool isBold , int color )
		{
			try {
				InteropExcel.Range range;
				//Formatirame
				range = excel.Range ["A" + _indexRow.ToString(), "C" + _indexRow.ToString()];
				if (color > 0 ) 	range.Interior.ColorIndex = color ; //-1
				if (isBold) 		range.Font.Bold = isBold ;

				//Vuvejdane na danni
				range = excel.Range ["A" + _indexRow.ToString(), "A" + _indexRow.ToString()];
				range.Value2 = _dataRow.firstName;

				range = excel.Range ["B" + _indexRow.ToString(), "B" + _indexRow.ToString()];
				range.Value2 = _dataRow.lastName;

				range = excel.Range ["C" + _indexRow.ToString(), "C" + _indexRow.ToString()];
				range.Value2 = _dataRow.age;
			}catch{
			}
		}