翻譯|產品更新|編輯:李顯亮|2019-06-05 15:37:28.467|閱讀 337 次
概述:Aspose.Words for .Net更新至v19.6版本,新增從Word文檔中提取VBA宏的API,實現了表格樣式的公共API,修復多項Bug。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Words for .NET是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。通過集成API,開發人員可以執行的一些基本任務,例如設計具有標準郵件合并字段的全功能Microsoft Word報告,幾種常用格式之間的可靠轉換,頁面的高保真渲染,所有文檔元素的格式化等等。
Aspose.Words for .Net更新至v19.6版本,新增從Word文檔中提取VBA宏的API,實現了表格樣式的公共API,修復多項Bug!
【點擊下載最新版Aspose.Words for .Net】
key | 概述 | 類別 |
---|---|---|
WORDSNET-5312 | 支持創建表格樣式 | 新功能 |
WORDSNET-17604 | 提供一種訪問特定TableStyle的Cell Padding屬性的方法 | 新功能 |
WORDSNET-18570 | 未識別水平合并單元格 | 新功能 |
WORDSNET-17757 | 提供API以從Word文檔中提取VBA宏 | 新功能 |
WORDSNET-18400 | 添加功能以修改表格樣式 | 新功能 |
WORDSNET-3714 | 考慮添加從文檔中讀取宏的功能 | 新功能 |
WORDSNET-18473 | 實現軟件和硬件模式渲染之間的切換 | 新功能 |
WORDSNET-9641 | 訪問表格樣式的信息 | 新功能 |
WORDSNET-18372 | 調用Document.UpdateFields方法時發生System.NullReferenceException | Bug修復 |
WORDSNET-18556 | 渲染期間發生System.IndexOutOfRangeException | Bug修復 |
WORDSNET-18407 | Table.AutoFit不適用于AutoFitBehavior.AutoFitToWindow | Bug修復 |
WORDSNET-18566 | 將RTF轉換為PDF后 - 缺少部分文本 | Bug修復 |
WORDSNET-16363 | SVG梯度問題 | Bug修復 |
? ? ? ? ? ?
更多更新細則可參考【Aspose.Words for Java v19.5更新說明】
導出文檔時始終會壓縮大型元文件。但是由于性能原因,不會壓縮小元文件。Word會壓縮所有元文件,無論其大小如何。此外,其他一些文檔編輯器(如LibreOffice)無法讀取未壓縮的元文件。為了允許用戶選擇適當的行為,DocSaveOptions類中引入了以下選項:
////// Whenfalse, small metafiles are not compressed for performance reason. /// Default value is true, all metafiles are compressed regardless of its size. ///public bool AlwaysCompressMetafiles
用例:
Document doc = new Document(@"sourse.doc"); DocSaveOptions saveOptions = new DocSaveOptions(); saveOptions.AlwaysCompressMetafiles = false; doc.Save("SmallMetafilesUncompressed.doc", saveOptions);
將出于安全原因刪除此屬性
////// Returns true if a valid license has been applied; false if the component is running in evaluation mode. ///[Obsolete("This property is obsolete. SetLicense() method raises an exception if license is invalid.")] public bool IsLicensed
實現了訪問VBA項目源代碼的功能。已添加以類:VbaProject,VbaModuleCollection,VbaModule。
////// Provides access to VBA project information. /// A VBA project inside the document is defined as a collection of VBA modules. ///public class VbaProject { ////// Returns VBA project name. ///public string Name { get; } ////// Returns collection of VBA project modules. ///public VbaModuleCollection Modules { get; } } ////// Provides access to VBA project module. ///public class VbaModule { ////// Returns VBA project module name. ///public string Name { get; } ////// Returns VBA project module source code. ///public string SourceCode { get; } }
用例:
Document doc = new Document(filename); if(doc.VbaModule != null) foreach(VbaModule module in doc.VbaProject.Modules) Console.WriteLine(module.SourceCode);
已從Range類中刪除已廢棄的方法Replace。并修復了新FindReplacer中的一些小錯誤。
////// Replaces all occurrences of a character pattern specified by a regular expression with another string. /////////Replaces the whole match captured by the regular expression.///Method is able to process breaks in both pattern and replacement strings./// You should use special meta-characters if you need to work with breaks: //////&p - paragraph break///&b - section break///&m - page break///&l - manual line break////// To leave any meta-character intact a parametershould be set to true. //////A regular expression pattern used to find matches.///A string to replace all occurrences of pattern.///object to specify additional options.///The number of replacements made.public int Replace(string pattern, string replacement) public int Replace(string pattern, string replacement, FindReplaceOptions options) public int Replace(Regex pattern, string replacement) public int Replace(Regex pattern, string replacement, FindReplaceOptions options)
新的公共屬性已添加到TableStyle類中,并且已實現新的公共類型ConditionalStyleCollection,ConditionalStyle,ConditionalStyleType。
public class TableStyle : Style { // Gets or sets a flag indicating whether text in a table row is allowed to split across a page break. // The default value is true. public bool AllowBreakAcrossPages { get; set; } // Gets the collection of default cell borders for the style. public BorderCollection Borders { get; } // Gets or sets the amount of space (in points) to add to the left of the contents of table cells. public double LeftPadding { get; set; } // Gets or sets the amount of space (in points) to add to the right of the contents of table cells. public double RightPadding { get; set; } // Gets or sets the amount of space (in points) to add above the contents of table cells. public double TopPadding { get; set; } // Gets or sets the amount of space (in points) to add below the contents of table cells. public double BottomPadding { get; set; } // Specifies the alignment for the table style. // The default value is TableAlignment.Left. public TableAlignment Alignment { get; set; } // Gets or sets the amount of space (in points) between the cells. public double CellSpacing { get; set; } // Gets or sets whether this is a style for a right-to-left table. // When true, the cells in rows are laid out right to left. // The default value is false. public bool Bidi { get; set; } // Gets or sets the value that represents the left indent of a table. public double LeftIndent { get: set; } // Gets a Shading object that refers to the shading formatting for table cells. public Shading Shading { get; } // Gets or sets a number of rows to include in the banding when the style specifies odd/even row banding. public int RowStripe { get; set; } // Gets or sets a number of columns to include in the banding when the style specifies odd/even columns banding. public int ColumnStripe { get; set; } // Collection of conditional styles that may be defined for this table style. public ConditionalStyleCollection ConditionalStyles { get; } } // Represents a collection of ConditionalStyle objects. // It is not possible to add or remove items from this collection. It contains permanent set of items: one item for // each value of the ConditionalStyleType enumeration type. public class ConditionalStyleCollection : IEnumerable{ // Clears all conditional styles of the table style. public void ClearFormatting(); // Retrieves a ConditionalStyle object by conditional style type. public ConditionalStyle this[ConditionalStyleType conditionalStyleType] { get; } // Retrieves a ConditionalStyle object by index. // index: Zero-based index of the conditional style to retrieve. public ConditionalStyle this[int index] { get; } // Gets the number of conditional styles in the collection. public int Count { get; } // Gets the first row style. public ConditionalStyle FirstRow { get; } // Gets the first column style. public ConditionalStyle FirstColumn { get; } // Gets the last row style. public ConditionalStyle LastRow { get; } // Gets the last column style. public ConditionalStyle LastColumn { get; } // Gets the odd row banding style. public ConditionalStyle OddRowBanding { get; } // Gets the odd column banding style. public ConditionalStyle OddColumnBanding { get; } // Gets the even row banding style. public ConditionalStyle EvenRowBanding { get; } // Gets the even column banding style. public ConditionalStyle EvenColumnBanding { get; } // Gets the top left cell style. public ConditionalStyle TopLeftCell { get; } // Gets the top right cell style. public ConditionalStyle TopRightCell { get; } // Gets the bottom left cell style. public ConditionalStyle BottomLeftCell { get; } // Gets the bottom right cell style. public ConditionalStyle BottomRightCell { get; } } // Represents special formatting applied to some area of a table with assigned table style. public class ConditionalStyle { // Clears formatting of this conditional style. public void ClearFormatting(); // Gets the paragraph formatting of the conditional style. public ParagraphFormat ParagraphFormat { get: } // Gets the character formatting of the conditional style. public Font Font { get; } // Gets a Shading object that refers to the shading formatting for this conditional style. public Shading Shading { get; } // Gets the collection of default cell borders for the conditional style. public BorderCollection Borders { get; } // Gets or sets the amount of space (in points) to add to the left of the contents of table cells. public double LeftPadding { get; set; } // Gets or sets the amount of space (in points) to add to the right of the contents of table cells. public double RightPadding { get; set; } // Gets or sets the amount of space (in points) to add above the contents of table cells. public double TopPadding { get; set; } // Gets or sets the amount of space (in points) to add below the contents of table cells. public double BottomPadding { get; set; } // Gets table area to which this conditional style relates. public ConditionalStyleType Type { get; } } // Represents possible table areas to which conditional formatting may be defined in a table style. public enum ConditionalStyleType { // Specifies formatting of the first row of a table. FirstRow, // Specifies formatting of the first column of a table. FirstColumn, // Specifies formatting of the last row of a table. LastRow, // Specifies formatting of the last column of a table. LastColumn, // Specifies formatting of odd-numbered row stripe. OddRowBanding, // Specifies formatting of odd-numbered column stripe. OddColumnBanding, // Specifies formatting of even-numbered row stripe. EvenRowBanding, // Specifies formatting of even-numbered column stripe. EvenColumnBanding, // Specifies formatting of the top left cell of a table. TopLeftCell, // Specifies formatting of the top right cell of a table. TopRightCell, // Specifies formatting of the bottom left cell of a table. BottomLeftCell, // Specifies formatting of the bottom right cell of a table. BottomRightCell }
MS Word使用了兩種眾所周知的技術來實現表中的水平合并單元格。第一個是合并標志,如Cell.CellFormat。HorizontalMerge,但是根據最新的MS Word行為,似乎不再使用這種方式,而且MS Word只是不寫merge標志。相反,MS Word使用了另一種技術,即單元格按其寬度水平合并。
因此,當單元格按其寬度水平合并時 - 沒有合并標志,當然,沒有辦法使用合并標志來檢測合并的單元格。一些客戶發現這很不方便。為了解決這個不便,我們添加了一個新的公共方法,將通過其寬度水平合并的單元格轉換為由flags水平合并的單元格。
用例:
Document doc = new Document(filename); Table table = doc.FirstSection.Body.Tables[0]; table.ConvertToHorizontallyMergedCells(); // Now merged cells have appropriate merge flags.
Aspose.Words現已加入20萬+用戶答謝惠,現在訂購最高可省30000元!>>進入搶購通道
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn