提交当前本机整理版本

This commit is contained in:
cyf
2026-07-02 10:11:39 +00:00
parent c10a5d64c7
commit aacefa24f8
822 changed files with 196665 additions and 14263 deletions
+39 -1
View File
@@ -4635,4 +4635,42 @@ namespace Lskj.Control.Model
{
result = result.Replace(invalidChar, '_');
}
result = Regex.Replace(result,
result = Regex.Replace(result, @"[\x00-\x1F]", "_").Trim('\'');
if (string.IsNullOrWhiteSpace(result))
{
result = "Sheet";
}
if (result.Length > 31)
{
result = result.Substring(0, 31);
}
return result;
}
/// <summary>
/// 获取可作为临时文件名的Excel名称。
/// </summary>
/// <param name="fileName">原始文件名。</param>
/// <returns>处理后的文件名。</returns>
private static string GetSafeExcelFileName(string fileName)
{
string result = GetSafeWorksheetName(fileName);
foreach (char invalidChar in Path.GetInvalidFileNameChars())
{
result = result.Replace(invalidChar, '_');
}
if (string.IsNullOrWhiteSpace(result))
{
result = "Sheet";
}
return result;
}
}
}