Quellcode durchsuchen

转换-csv设置更改

liyijie vor 2 Jahren
Ursprung
Commit
cdf6fd178c

+ 6 - 1
PDF Office/Helper/ConverterHelper.cs

@@ -13,6 +13,7 @@ using PDF_Office.CustomControl;
 using Exception = System.Exception;
 using ImageMagick;
 using System.IO.Compression;
+using System.Windows;
 
 namespace PDF_Office.Helper
 {
@@ -143,7 +144,11 @@ namespace PDF_Office.Helper
                 result = await Task.Run(() => csvConverter.Convert(outputFolder, ref outputFileName, csvOptions, pageArray, ref error, getProgress));
                 if (result)
                 {
-                    CommonHelper.ShowFileBrowser(outputFileName.Replace("/", "\\"));
+                    if (File.Exists(outputFileName))
+                        CommonHelper.ShowFileBrowser(outputFileName.Replace("/", "\\"));
+                    else
+                        MessageBox.Show("None CSV");
+                    
                 }
             }
             catch (Exception ex)

+ 3 - 0
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterCSVDialogViewModel.cs

@@ -218,8 +218,10 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 switch (radioButton)
                 {
                     case "ForEachPageRadioBtn":
+                        ConverterCSVModel.Options.IsMergeCsv = false;
                         break;
                     case "OnlyTableRadioBtn":
+                        ConverterCSVModel.Options.IsMergeCsv = true;
                         break;
                     default:
                         break;
@@ -250,6 +252,7 @@ namespace PDF_Office.ViewModels.Dialog.ConverterDialogs
                 if (currentViewer.Tag != null) { ConverterCSVModel.Pawssword = currentViewer.Tag.ToString(); }
                 ConverterCSVModel.InputPath = pdfViewer.Document.FilePath;
                 FileInfo fileinfo = new FileInfo(ConverterCSVModel.InputPath);
+                ConverterCSVModel.Options.IsMergeCsv = false;
                 ConverterCSVModel.OutputPath = fileinfo.DirectoryName;
             }
         }

+ 3 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterCSVViewModel.cs

@@ -29,8 +29,10 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 switch (radioButton)
                 {
                     case "ForEachPageRadioBtn":
+                        homePageConverterDialogViewModel.ConverterCSVModel.Options.IsMergeCsv = false;
                         break;
                     case "OnlyTableRadioBtn":
+                        homePageConverterDialogViewModel.ConverterCSVModel.Options.IsMergeCsv = true;
                         break;
                     default:
                         break;
@@ -47,6 +49,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
             if (homePageConverterVM != null)
             {
                 homePageConverterDialogViewModel = homePageConverterVM;
+                homePageConverterDialogViewModel.ConverterCSVModel.Options.IsMergeCsv = false;
             }
         }
 

+ 1 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogViewModel.cs

@@ -444,7 +444,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcess
                 fileNamesIndex++;
             }
             ConverterGridIsEnabled = "True";
-            HomePageBatchProcessingDialogModel.closeDialog = true;
+            HomePageBatchProcessingDialogModel.closeDialog = false;
         }
         #endregion
 

+ 13 - 7
PDF Office/Views/Dialog/ConverterDialogs/ConverterCSVDialog.xaml

@@ -30,20 +30,26 @@
                 </Grid>
                 <Grid Grid.Column="1">
                     <StackPanel Margin="18,16,0,0">
-                        <StackPanel>
-                            <!--<RadioButton
+                        <TextBlock
+                                Width="60"
+                                Height="20"
+                                HorizontalAlignment="Left"
+                                Text="CSV设置:" />
+                        <StackPanel Margin="0,8,0,0">
+                            <RadioButton
+                                IsChecked="True"
                                 Name="ForEachPageRadioBtn"
                                 Command="{Binding RadioButtonCommand}"
                                 CommandParameter="{Binding ElementName=ForEachPageRadioBtn, Path=Name}">
-                                <TextBlock Text="将每个页面转换为一个单独的文档" />
-                            </RadioButton>-->
+                                <TextBlock Text="为每个表格创建工作表" />
+                            </RadioButton>
                             <RadioButton
-                                IsChecked="True"
+                                
                                 Name="OnlyTableRadioBtn"
                                 Margin="0,6,0,0"
                                 Command="{Binding RadioButtonCommand}"
-                                CommandParameter="{Binding ElementName=ForTheDocRadioBtn, Path=Name}">
-                                <TextBlock Text="只提取表格" />
+                                CommandParameter="{Binding ElementName=OnlyTableRadioBtn, Path=Name}">
+                                <TextBlock Text="为文档创建单个工作表" />
                             </RadioButton>
                         </StackPanel>
                         <StackPanel Margin="0,14,0,0" Orientation="Vertical">

+ 21 - 6
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterCSV.xaml

@@ -4,12 +4,27 @@
              xmlns:prism="http://prismlibrary.com/"             
              prism:ViewModelLocator.AutoWireViewModel="True">
     <Grid>
-        <StackPanel Width="245">
-            <!--<RadioButton Name="ForEachPageRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForEachPageRadioBtn,Path=Name}">
-                <TextBlock Text="将每个页面转换为一个单独的文档"/>
-            </RadioButton>-->
-            <RadioButton Margin="0,6,0,0" Name="OnlyTableRadioBtn" Command="{Binding RadioButtonCommand}" CommandParameter="{Binding ElementName=ForTheDocRadioBtn,Path=Name}" IsChecked="True">
-                <TextBlock Text="只提取表格"/>
+        
+        <StackPanel Width="245" >
+            <TextBlock
+                                Width="60"
+                                Height="20"
+                                HorizontalAlignment="Left"
+                                Text="CSV设置:" />
+            <RadioButton
+                                IsChecked="True"
+                                Name="ForEachPageRadioBtn"
+                                Command="{Binding RadioButtonCommand}"
+                                CommandParameter="{Binding ElementName=ForEachPageRadioBtn, Path=Name}"
+                Margin="0,8,0,0">
+                <TextBlock Text="为每个表格创建工作表" />
+            </RadioButton>
+            <RadioButton
+                                Name="OnlyTableRadioBtn"
+                                Margin="0,6,0,0"
+                                Command="{Binding RadioButtonCommand}"
+                                CommandParameter="{Binding ElementName=OnlyTableRadioBtn, Path=Name}">
+                <TextBlock Text="为文档创建单个工作表" />
             </RadioButton>
         </StackPanel>
     </Grid>