Files
Groupware/SubProject/FCOMMON/Util_Farpoint.cs

52 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FCOMMON
{
public static partial class Util
{
public static void FPColSizeAuto(FarPoint.Win.Spread.FpSpread fp)
{
// fp.ActiveSheet.DataAutoSizeColumns = true;
foreach (FarPoint.Win.Spread.Column col in fp.ActiveSheet.Columns)
{
col.Width = 0;
col.Width = col.GetPreferredWidth();
}
for (int i = 0; i < fp.ActiveSheet.Rows.Count; i++)
fp.ActiveSheet.SetRowHeight(i, 25);
}
public static void FPCollSizeReset(FarPoint.Win.Spread.FpSpread fp)
{
foreach (FarPoint.Win.Spread.Column col in fp.ActiveSheet.Columns)
{
col.Width = 100;
}
}
public static void FPColsizeSave(FarPoint.Win.Spread.FpSpread dv, string fn)
{
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
foreach (FarPoint.Win.Spread.Column col in dv.ActiveSheet.Columns)
ini.set_Data("colsize", "index_" + col.Index.ToString(), col.Width.ToString());
ini.Flush();
}
public static void FPColSizeLoad(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 width = ini.get_Data("colsize", "index_" + col.Index.ToString(), "0");
col.Width = float.Parse(width);
}
}
}
}