Files
Groupware/SubProject/FPJ0000/FPUtil.cs

44 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FPJ0000
{
public static class FPUtil
{
public static void ColsizeSave(FarPoint.Win.Spread.FpSpread dv, string fn)
{
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
foreach (FarPoint.Win.Spread.Column col in dv.ActiveSheet.Columns)
{
//열 필드명을 보고 저장하거나 번호로 저장한다
var keyName = "index_" + col.Index.ToString();
if (col.DataField != "") keyName = col.DataField;
ini.set_Data("colsize", keyName, col.Width.ToString());
}
ini.Flush();
}
public static void ColSizeLoad(ref FarPoint.Win.Spread.FpSpread dv, string fn)
{
if (System.IO.File.Exists(fn) == false) return;
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
foreach (FarPoint.Win.Spread.Column col in dv.ActiveSheet.Columns)
{
//필드로 저장된게 있다면 그것을 쓰고 아니라면 번호를 쓴다
var strWidth = "100";
if(col.DataField != "")
{
strWidth = ini.get_Data("colsize", col.DataField, "100"); //필드명으로 읽어서 자료가 없다면 인덱스로 한다
if (string.IsNullOrEmpty(strWidth) == true) strWidth = "100";
//if (strWidth == "") strWidth = ini.get_Data("colsize", "index_" + col.Index.ToString(), "100");
}
else strWidth = ini.get_Data("colsize", "index_" + col.Index.ToString(), "0");
col.Width = float.Parse(strWidth);
}
}
}
}