using OfficeExcel = Microsoft.Office.Interop.Excel;
namespace Core.File.Excel
{
/// <summary>
/// ベース:Shapeアクセサー
/// </summary>
public class BaseShapeAccessor : BaseExcelAccessor
{
#region 構築・破棄
/// <summary>
/// コンストラクタ
/// </summary>
/// <param name="shape"></param>
/// <param name="application">ExcelApplicationアクセサー</param>
protected BaseShapeAccessor(OfficeExcel.Shape shape, ExcelAccessor application)
:base(application)
{
Shape = shape;
}
#endregion
#region プロパティ
/// <summary>cell</summary>
protected OfficeExcel.Shape Shape { get; private set; }
/// <summary>
/// Top
/// </summary>
public float Top
{
get
{
return Shape.Top;
}
set
{
Shape.Top = value;
}
}
/// <summary>
/// Left
/// </summary>
public float Left
{
get
{
return Shape.Left;
}
set
{
Shape.Left = value;
}
}
/// <summary>
/// Width
/// </summary>
public float Width
{
get
{
return Shape.Width;
}
set
{
Shape.Width = value;
}
}
/// <summary>
/// Height
/// </summary>
public float Height
{
get
{
return Shape.Height;
}
set
{
Shape.Height = value;
}
}
/// <summary>
/// 名前
/// </summary>
public string Name
{
get
{
return Shape.Name;
}
set
{
Shape.Name = value;
}
}
#endregion
#region Shape
/// <summary>
/// Shape取得
/// </summary>
/// <param name="baseShapeAccessor"></param>
/// <returns></returns>
protected OfficeExcel.Shape GetShape(BaseShapeAccessor baseShapeAccessor)
{
return baseShapeAccessor.Shape;
}
#endregion
#region Line
/// <summary>Line</summary>
protected OfficeExcel.LineFormat line;
/// <summary>Line</summary>
protected OfficeExcel.LineFormat Line
{
get
{
if (this.line == null)
{
this.line = Shape.Line;
ReleaseComObjects.Add(this.line);
}
return this.line;
}
}
/// <summary>LineForeColor</summary>
protected OfficeExcel.ColorFormat lineForeColor;
/// <summary>LineForeColor</summary>
protected OfficeExcel.ColorFormat LineForeColor
{
get
{
if (this.lineForeColor == null)
{
this.lineForeColor = Line.ForeColor;
ReleaseComObjects.Add(this.lineForeColor);
}
return this.lineForeColor;
}
}
/// <summary>枠線の色</summary>
public int LineForeColorRGB
{
get
{
return LineForeColor.RGB;
}
set
{
LineForeColor.RGB = value;
}
}
/// <summary>枠線の太さ</summary>
public float LineWeight
{
get
{
return Line.Weight;
}
set
{
Line.Weight = value;
}
}
/// <summary>LineVisible</summary>
public bool LineVisible
{
set
{
if (value)
{
Line.Visible = MsoTriState.msoTrue;
}
else
{
Line.Visible = MsoTriState.msoFalse;
}
}
}
/// <summary>線のスタイル</summary>
public ExcelLineStyle LineStyle
{
get
{
return (ExcelLineStyle)Line.Style;
}
set
{
Line.Style = (MsoLineStyle)value;
}
}
/// <summary>線の破線スタイル</summary>
public ExcelLineDashStyle LineDashStyle
{
get
{
return (ExcelLineDashStyle)Line.DashStyle;
}
set
{
Line.DashStyle = (MsoLineDashStyle)value;
}
}
#endregion
}
#region 列挙型
/// <summary>ステートのブール型</summary>
public enum ExcelTriState
{
/// <summary>サポートされていません。</summary>
CTrue = MsoTriState.msoCTrue,
/// <summary>偽 (False)</summary>
False = MsoTriState.msoFalse,
/// <summary>サポートされていません。</summary>
TriStateMixed = MsoTriState.msoTriStateMixed,
/// <summary>サポートされていません。</summary>
TriStateToggle = MsoTriState.msoTriStateToggle,
/// <summary>真 (True)</summary>
True = MsoTriState.msoTrue
}
/// <summary>線のスタイル</summary>
public enum ExcelLineStyle
{
/// <summary>単一の線</summary>
LineSingle = MsoLineStyle.msoLineSingle,
/// <summary>サポートされていません。</summary>
LineStyleMixed = MsoLineStyle.msoLineStyleMixed,
/// <summary>各辺に細い線が添えられた太い線</summary>
LineThickBetweenThin = MsoLineStyle.msoLineThickBetweenThin,
/// <summary>細い線の横に太い線が添えられます。水平線の場合、細い線の上に太い線が添えられます。垂直線の場合、細い線の左に太い線が添えられます。</summary>
LineThickThin = MsoLineStyle.msoLineThickThin,
/// <summary>細い線の横に太い線が添えられます。水平線の場合、細い線の下に太い線が添えられます。垂直線の場合、細い線の右に太い線が添えられます。</summary>
LineThinThick = MsoLineStyle.msoLineThinThick,
/// <summary>2 本の細い線</summary>
LineThinThin = MsoLineStyle.msoLineThinThin
}
/// <summary>線の破線スタイル</summary>
public enum ExcelLineDashStyle
{
/// <summary>破線</summary>
LineDash = MsoLineDashStyle.msoLineDash,
/// <summary>一点鎖線</summary>
LineDashDot = MsoLineDashStyle.msoLineDashDot,
/// <summary>二点鎖線</summary>
LineDashDotDot = MsoLineDashStyle.msoLineDashDotDot,
/// <summary>サポートされていません。</summary>
LineDashStyleMixed = MsoLineDashStyle.msoLineDashStyleMixed,
/// <summary>長破線</summary>
LineLongDash = MsoLineDashStyle.msoLineLongDash,
/// <summary>長鎖線</summary>
LineLongDashDot = MsoLineDashStyle.msoLineLongDashDot,
/// <summary>点線 (丸)</summary>
LineRoundDot = MsoLineDashStyle.msoLineRoundDot,
/// <summary>実線</summary>
LineSolid = MsoLineDashStyle.msoLineSolid,
/// <summary>点線 (角)</summary>
LineSquareDot = MsoLineDashStyle.msoLineSquareDot
}
#endregion
}
0 件のコメント:
コメントを投稿