public void SetText(int Pi_Row, int Pi_Col, object Po_Value, Color Pc_BackColor, Color Pc_ForeColor, EM_EXCEL_HALIGN Pe_HAlign, EM_EXCEL_VALIGN Pe_VAlign) { Excel.Range Le_Range = null; try { Le_Range = Mws_Sheet.get_Range(Mws_Sheet.Cells[Pi_Row, Pi_Col], Mws_Sheet.Cells[Pi_Row, Pi_Col]); Le_Range.Font.Bold = Mf_Font.Bold; Le_Range.Font.Size = Mf_Font.Size; Le_Range.Interior.Color = ColorTranslator.ToOle(Pc_BackColor); Le_Range.Font.Color = ColorTranslator.ToOle(Pc_ForeColor); Le_Range.HorizontalAlignment = Pe_HAlign; Le_Range.VerticalAlignment = Pe_VAlign; Le_Range.Value2 = Po_Value; } catch (Exception) { throw; } finally { if (Le_Range != null) { Marshal.ReleaseComObject(Le_Range); } } }
public void SetRangeDataVet(int Pi_Row, int Pi_Col, object[,] Po_Value, EM_EXCEL_HALIGN Pe_HAlign, EM_EXCEL_VALIGN Pe_VAlign) { Excel.Range Le_Range = null; Le_Range = Mws_Sheet.get_Range(Mws_Sheet.Cells[Pi_Row, Pi_Col], Mws_Sheet.Cells[Pi_Row + Po_Value.GetLength(0) - 1, Pi_Col + Po_Value.GetLength(1) - 1]); Le_Range.set_Value(Missing.Value, Po_Value); Le_Range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; Le_Range.HorizontalAlignment = Pe_HAlign; Le_Range.VerticalAlignment = Pe_VAlign; Le_Range.EntireRow.AutoFit(); Le_Range.EntireColumn.AutoFit(); Le_Range.WrapText = false; Le_Range.Font.Bold = Mf_Font.Bold; Le_Range.Font.Size = Mf_Font.Size; }