加入若干pgsql的接口
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using NPOI.SS.UserModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
@@ -42,6 +43,7 @@ namespace Ramitta.lib
|
||||
obj.UpdateLayout();
|
||||
// 处理Dispatcher队列中的其他挂起的操作,确保UI更新
|
||||
Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
|
||||
|
||||
});
|
||||
}
|
||||
public static SolidColorBrush GenerateRandomColor(SolidColorBrush color = null, bool? requireLightColor = null)
|
||||
@@ -221,6 +223,38 @@ namespace Ramitta.lib
|
||||
}
|
||||
return pngEncoder;
|
||||
}
|
||||
|
||||
public static void 刷新子表(string selectedFile, ComboBox combox)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 使用NPOI打开Excel文件
|
||||
using (FileStream fileStream = new FileStream(selectedFile, FileMode.Open, FileAccess.Read,FileShare.ReadWrite))
|
||||
{
|
||||
IWorkbook workbook = WorkbookFactory.Create(fileStream);
|
||||
|
||||
// 清空现有项
|
||||
combox.Items.Clear();
|
||||
|
||||
// 遍历所有sheet并添加到下拉框
|
||||
for (int i = 0; i < workbook.NumberOfSheets; i++)
|
||||
{
|
||||
string sheetName = workbook.GetSheetName(i);
|
||||
combox.Items.Add(sheetName);
|
||||
}
|
||||
|
||||
// 自动选择最后一个sheet
|
||||
if (combox != null && combox.Items != null && combox.Items.Count > 0)
|
||||
{
|
||||
combox.SelectedIndex = combox.Items.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//DebugBar(Debugtag, $"读取Excel文件时出错:{ex.Message}", 错误红色);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 任务操作
|
||||
|
||||
Reference in New Issue
Block a user