Compare commits

..

No commits in common. "ac3a5bee52c0b5a9a9eb713a557a550f28878162" and "f5aebee3eb09ffd9bc01fbdf090373742c8b3092" have entirely different histories.

2 changed files with 6 additions and 13 deletions

View File

@ -5,14 +5,14 @@ using System.IO;
using UnityEngine; using UnityEngine;
using System.Windows.Forms; using System.Windows.Forms;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System;
public class AsposeHelper : MonoBehaviour 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文档 // 加载Word文档
Document doc = new Document(Global.reportDemoPath); Document doc = new Document(Global.reportDemoPath);
@ -25,23 +25,21 @@ public class AsposeHelper : MonoBehaviour
doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions()); doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
} }
// 替换文本 // 替换文本
SaveWithDialog(doc, callback); SaveWithDialog(doc);
//Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath); //Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath);
} }
private static void SaveWithDialog(Document doc, Action<DialogResult> callback) private static void SaveWithDialog(Document doc)
{ {
SaveFileDialog dialog = new SaveFileDialog(); SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "Word文档|*.docx"; dialog.Filter = "Word文档|*.docx";
var result = dialog.ShowDialog(); if (dialog.ShowDialog() == DialogResult.OK)
if (result == DialogResult.OK)
{ {
doc.Save(dialog.FileName); doc.Save(dialog.FileName);
} }
callback?.Invoke(result);
} }
} }

View File

@ -36,12 +36,7 @@ namespace QFramework.Example
}); });
loader.LoadAsync(); loader.LoadAsync();
#elif UNITY_STANDALONE_WIN #elif UNITY_STANDALONE_WIN
DownLoad.interactable = false; AsposeHelper.Writer(GetScoreDataJson());
AsposeHelper.Writer(GetScoreDataJson(), result =>
{
Debug.LogError("111");
DownLoad.interactable = true;
});
#endif #endif