|
|
|
@ -37,6 +37,7 @@ using SparkClient.Model.Attributes; |
|
|
|
|
using SparkClient.Model.Common; |
|
|
|
|
using PaperSize = System.Drawing.Printing.PaperSize; |
|
|
|
|
using SharpDX.Direct2D1.Effects; |
|
|
|
|
using Exception = System.Exception; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace SparkClient.ViewModel.Grading; |
|
|
|
@ -1997,10 +1998,19 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
|
|
|
|
|
Microsoft.Office.Interop.Excel.Workbook workbook = excelApp.Workbooks.Open(tempFilePath); |
|
|
|
|
|
|
|
|
|
string? targetPrinter = System.Drawing.Printing.PrinterSettings.InstalledPrinters |
|
|
|
|
.Cast<string>() |
|
|
|
|
.FirstOrDefault(p => p.Contains(ConfigurationHelper.ReadConfigValue("PrintName"))); |
|
|
|
|
if (targetPrinter == null) |
|
|
|
|
{ |
|
|
|
|
throw new Exception($"未找到打印机{targetPrinter}"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 打印配置 |
|
|
|
|
workbook.PrintOut( |
|
|
|
|
Copies: 1, |
|
|
|
|
Preview: false // 禁用打印预览 |
|
|
|
|
Preview: false, |
|
|
|
|
ActivePrinter: targetPrinter |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// 关闭工作簿(不保存修改) |
|
|
|
|