private void GetAlignment(FarPoint.Win.Spread.Cell cell, out XL.XlHAlign hAlign, out XL.XlVAlign vAlign) { switch (cell.HorizontalAlignment) { case CellHorizontalAlignment.Center: hAlign = XL.XlHAlign.xlHAlignCenter; break; case CellHorizontalAlignment.General: hAlign = XL.XlHAlign.xlHAlignGeneral; break; case CellHorizontalAlignment.Left: hAlign = XL.XlHAlign.xlHAlignLeft; break; case CellHorizontalAlignment.Right: hAlign = XL.XlHAlign.xlHAlignRight; break; default: hAlign = XL.XlHAlign.xlHAlignGeneral; break; } switch (cell.VerticalAlignment) { case CellVerticalAlignment.Bottom: vAlign = XL.XlVAlign.xlVAlignBottom; break; case CellVerticalAlignment.Center: vAlign = XL.XlVAlign.xlVAlignCenter; break; case CellVerticalAlignment.General: vAlign = XL.XlVAlign.xlVAlignTop; break; case CellVerticalAlignment.Top: vAlign = XL.XlVAlign.xlVAlignTop; break; default: vAlign = XL.XlVAlign.xlVAlignTop; break; } }
/// <summary> /// Cell에 Fomula셑팅을 한다. /// </summary> /// <param name="fp"></param> /// <param name="sv"></param> /// <param name="cell"></param> /// <param name="formulaString"></param> /// <param name="celltype">변경할 셀 타입 FarPoint.Win.Spread.CellType 네임스페이스에서 새로운 클래스생성 하여 넘긴다. 무변경 null</param> public static void Invoke_CellFormula_Set(FarPoint.Win.Spread.FpSpread fp, FarPoint.Win.Spread.SheetView sv, FarPoint.Win.Spread.Cell cell, string formulaString, FarPoint.Win.Spread.CellType.BaseCellType celltype) { if (fp.InvokeRequired) { fp.BeginInvoke(new delInvoke_CellFormula_Set(Invoke_CellFormula_Set), new object[] { fp, sv, cell, formulaString, celltype }); return; } string textvalue = string.Empty; cell.Formula = formulaString; if (celltype != null) { cell.CellType = celltype; } /* * textvalue = cell.Text; * FarPoint.Win.Spread.CellType.TextCellType t = new FarPoint.Win.Spread.CellType.TextCellType(); * cell.CellType = t; * cell.Formula = ""; * cell.Value = textvalue; */ }