Browse Source

合并-奇数页合并的部分代码

zhuyi 1 year ago
parent
commit
452861cfa4

+ 16 - 2
PDF Office/Model/Dialog/ToolsDialogs/MergeObject.cs

@@ -94,12 +94,12 @@ namespace PDF_Office.Model.Dialog.ToolsDialogs
             }
         }
 
-        private string setPageRange;
+        private List<int> setPageRange;
 
         /// <summary>
         /// 设置的文档页面范围
         /// </summary>
-        public string SetPageRange
+        public List<int> SetPageRange
         {
             get { return setPageRange; }
             set
@@ -108,6 +108,20 @@ namespace PDF_Office.Model.Dialog.ToolsDialogs
             }
         }
 
+        private string setPageRangeStr;
+
+        /// <summary>
+        /// 设置的文档页面范围
+        /// </summary>
+        public string SetPageRangeStr
+        {
+            get { return setPageRangeStr; }
+            set
+            {
+                SetProperty(ref setPageRangeStr, value);
+            }
+        }
+
         private string password="";
 
         /// <summary>

+ 8 - 1
PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs

@@ -252,7 +252,14 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
                     {
                         tempDoc.UnlockWithPassword(MergeObjectlist[i].Password);
                     }
-                    result = SaveDoc.ImportPages(tempDoc, MergeObjectlist[i].SetPageRange);
+                    if (!string.IsNullOrEmpty(MergeObjectlist[i].SetPageRangeStr))
+                    {
+                        result = SaveDoc.ImportPages(tempDoc, MergeObjectlist[i].SetPageRangeStr);
+                    }
+                    else
+                    {
+                        result = SaveDoc.ImportPages(tempDoc, CommonHelper.GetPageParmFromList(MergeObjectlist[i].SetPageRange));
+                    }
                     if (!result)
                     {
                         SaveDoc.Release();

+ 1 - 1
PDF Office/Views/Dialog/ToolsDialogs/MergeDialog.xaml

@@ -164,7 +164,7 @@
                                             <TextBlock Text="{Binding DocPageCount}"  FontFamily="Segoe UI" FontSize="14" FontWeight="Regular" Foreground="{StaticResource color.sys.text.neutral.lv3}"/>
                                         </StackPanel>
                                         <StackPanel Grid.Column="4" HorizontalAlignment="Stretch" VerticalAlignment="Center">
-                                            <customcontrol:WritableComboBox SelectedIndex="0" Width="150" Height="30" MaxPageRange="{Binding SDKPageCount}" Text="{Binding SetPageRange, Mode=TwoWay}"/>
+                                            <customcontrol:WritableComboBox SelectedIndex="0" Width="150" Height="30" MaxPageRange="{Binding SDKPageCount}" PageIndexList="{Binding SetPageRange, Mode=TwoWay}" Text="{Binding SetPageRangeStr,Mode=TwoWay}"/>
                                         </StackPanel>
                                         <TextBlock Grid.Column="6" Text="{Binding DocSize}"  HorizontalAlignment="Center" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
                                         <StackPanel Grid.Column="8" VerticalAlignment="Center" HorizontalAlignment="Stretch">