Compare commits
No commits in common. "ac3a5bee52c0b5a9a9eb713a557a550f28878162" and "f5aebee3eb09ffd9bc01fbdf090373742c8b3092" have entirely different histories.
ac3a5bee52
...
f5aebee3eb
@ -5,14 +5,14 @@ using System.IO;
|
||||
using UnityEngine;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
|
||||
public class AsposeHelper : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
public static void Writer(string json, Action<DialogResult> callback = null)
|
||||
public static void Writer(string json)
|
||||
{
|
||||
Debug.LogError(File.Exists(Global.reportDemoPath));
|
||||
// 加载Word文档
|
||||
Document doc = new Document(Global.reportDemoPath);
|
||||
|
||||
@ -25,23 +25,21 @@ public class AsposeHelper : MonoBehaviour
|
||||
doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
|
||||
}
|
||||
// 替换文本
|
||||
SaveWithDialog(doc, callback);
|
||||
SaveWithDialog(doc);
|
||||
//Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void SaveWithDialog(Document doc, Action<DialogResult> callback)
|
||||
private static void SaveWithDialog(Document doc)
|
||||
{
|
||||
SaveFileDialog dialog = new SaveFileDialog();
|
||||
dialog.Filter = "Word文档|*.docx";
|
||||
var result = dialog.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
doc.Save(dialog.FileName);
|
||||
}
|
||||
callback?.Invoke(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -36,12 +36,7 @@ namespace QFramework.Example
|
||||
});
|
||||
loader.LoadAsync();
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
DownLoad.interactable = false;
|
||||
AsposeHelper.Writer(GetScoreDataJson(), result =>
|
||||
{
|
||||
Debug.LogError("111");
|
||||
DownLoad.interactable = true;
|
||||
});
|
||||
AsposeHelper.Writer(GetScoreDataJson());
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user