设置内置文档属性的ScaleCrop和LinksUpToDate属性
可能的使用场景
ScaleCrop 和 LinksUpToDate 是OpenXml格式中定义的两个扩展内置文档属性。这些属性的用途如下
1) ScaleCrop
此元素指示文档缩略图的显示模式。将此元素设置为TRUE以启用文档缩略图的缩放以进行显示。将此元素设置为FALSE以启用文档缩略图的裁剪,以仅显示适合显示器的部分。
此元素的可能值由W3C XML Schema布尔数据类型定义。
2) LinksUpToDate
此元素指示文档中的超链接是否为最新状态。将此元素设置为TRUE表示超链接已更新。将此元素设置为FALSE表示超链接已过时。
此元素的可能值由W3C XML Schema布尔数据类型定义。
截图显示了app.xml文件中的这些属性
设置内置文档属性的ScaleCrop和LinksUpToDate属性
以下示例代码设置了工作簿的ScaleCrop 和LinksUpToDate扩展内置文档属性。请检查此代码生成的输出Excel文件,将其扩展名更改为.zip并解压其内容,然后查看如上截图所示的app.xml。
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create directory if it is not already present. | |
bool IsExists = System.IO.Directory.Exists(dataDir); | |
if (!IsExists) | |
System.IO.Directory.CreateDirectory(dataDir); | |
// Instantiating a Workbook object. | |
Workbook workbook = new Workbook(); | |
// Setting ScaleCrop and LinksUpToDate BuiltIn Document Properties. | |
workbook.BuiltInDocumentProperties.ScaleCrop = true; | |
workbook.BuiltInDocumentProperties.LinksUpToDate = true; | |
// Saving the Excel file. | |
workbook.Save(dataDir + "output.xls", SaveFormat.Auto); |