/// <summary>
/// 複製一個新的模板,複製成功則返回該模板的名稱
/// </summary>
/// <param name="templatePath"></param>
/// <returns></returns>
public string CopyTempLate(string templatePath)
{
try
{
if (!Directory.Exists(System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP"))
{
Directory.CreateDirectory(System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP");
}
string NewWord = System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP\\SYS_" + Guid.NewGuid().ToString().ToUpper() + "_TEMP.doc";
if (!File.Exists(NewWord))
{
File.Copy(templatePath, NewWord, false);
return NewWord;
}
else
{
NewWord = System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP\\SYS_" + Guid.NewGuid().ToString().ToUpper() + "_TEMP.doc";
File.Copy(templatePath, NewWord, false);
return NewWord;
}
}
catch (Exception ex)
{
return "";
}
}
/// 複製一個新的模板,複製成功則返回該模板的名稱
/// </summary>
/// <param name="templatePath"></param>
/// <returns></returns>
public string CopyTempLate(string templatePath)
{
try
{
if (!Directory.Exists(System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP"))
{
Directory.CreateDirectory(System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP");
}
string NewWord = System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP\\SYS_" + Guid.NewGuid().ToString().ToUpper() + "_TEMP.doc";
if (!File.Exists(NewWord))
{
File.Copy(templatePath, NewWord, false);
return NewWord;
}
else
{
NewWord = System.IO.Path.GetDirectoryName(templatePath) + " \\TEMP\\SYS_" + Guid.NewGuid().ToString().ToUpper() + "_TEMP.doc";
File.Copy(templatePath, NewWord, false);
return NewWord;
}
}
catch (Exception ex)
{
return "";
}
}