我们是否因为导出的属性每次都要手动切换而感到繁琐呢,是否可以让导出的属性做默认设置呢?
我们的新版本已经可以实现了,直接上代码:
针对不同的导出,我们都有不同的属性设置方法:
- viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- defaultExportSettings: {
- xls: {
- /* only rdlx */
- EnableToggles: { value: true },
- LayoutMode: { value: 'Galley' },
- RightToLeft: { value: true },
- /* only rpx */
- FileFormat: { value: 'Xls95' },
- AutoRowHeight: { value: true },
- DisplayGridLines: { value: true },
- Pagination: { value: false },
- /* both (rdlx and rpx) */
- MultiSheet: { value: false },
- SheetName: { value: 'Sheet_xls' },
- UseDefaultPalette: { value: true },
- Orientation: { value: 'Landscape' },
- PaperSize: { value: 'A5' },
- Password: { value: '123456' },
- ProtectedBy: { value: 'USER' },
- ReadOnlyRecommended: { value: true },
- WritePassword: { value: '123456' },
- FileName: { value: "ar16" }
- },
- xlsx: {
- /* only rdlx */
- EnableToggles: { value: true },
- LayoutMode: { value: 'Galley' },
- RightToLeft: { value: true },
- //OutputFormat: { value: 'Strict' },
- /* only rpx */
- AutoRowHeight: { value: true },
- DisplayGridLines: { value: false },
- Pagination: { value: false },
- OpenXmlStandard: { value: 'Strict' },
- /* both (rdlx and rpx) */
- MultiSheet: { value: false },
- SheetName: { value: 'Sheet_xls' },
- UseDefaultPalette: { value: true },
- OutputFormat: { value: 'Strict' },
- UseCompression: { value: false },
- Orientation: { value: 'Landscape' },
- PaperSize: { value: 'A5' },
- Password: { value: '123456' },
- ProtectedBy: { value: 'USER' },
- ReadOnlyRecommended: { value: true },
- WritePassword: { value: '123456' },
- FileName: { value: "ar16" }
- },
- doc: {
- Author: { value: 'USER', visible: true },
- BaseHref: { value: 'www.com' },
- Generator: { value: 'Created by USER' },
- PageHeight: { value: '10' },
- PageWidth: { value: '5' },
- Title: { value: 'TITLE_01' },
- FileName: { value: 'ar16_doc', visible: true }
- },
- docx: {
- Author: { value: 'USER' },
- CompanyName: { value: 'USER_COMPANY' },
- DocumentCompatibilityVersion: { value: 'Word2010' },
- DpiX: { value: 80 },
- DpiY: { value: 80 },
- Title: { value: 'TITLE_01' },
- TOCAutoUpdate: { value: true },
- Orientation: { value: 'Portrait' },
- PaperSize: { value: 'B4' },
- Password: { value: '123456' },
- ReadOnlyRecommended: { value: true },
- WritePassword: { value: '123456' },
- FileName: { value: 'ar16_doc' }
- },
- pdf: {
- /*only for rpx*/
- ConvertMetaToPng: { value: true },
- ExportBookmarks: { value: false },
- ImageInterpolation: { value: 'Auto' },
- ImageQuality: { value: 'Highest' },
- /*both (rdlx and rpx)*/
- Title: { value: 'Document' },
- Author: { value: 'USER' },
- Subject: { value: 'PDF' },
- Keywords: { value: 'PDF export' },
- Application: { value: 'AR16' },
- EmbedFonts: { value: 'All' },
- Version: { value: 'PDF-1.5' },
- UserPassword: { value: 'user_pwd' },
- OwnerPassword: { value: 'owner_pwd' },
- Encrypt: { value: true },
- FileName: { value: 'ar16_pdf', visible: true }
- },
- csv: {
- ColumnsDelimiter: { value: '.' },
- Encoding: { value: 'Unicode' },
- NoHeader: { value: true },
- QuotationMode: { value: "Always quote", visible: true },
- QuotationSymbol: { value: '\'' },
- RowsDelimiter: { value: '\\r\\n\\r\\n' },
- DateTimeFormat: { value: 'MM/dd/yyyy H:mm' },
- NumericFormat: { value: 'money' },
- FileName: { value: 'ar16_csv' }
- },
- json: {
- Formatted: { value: false },
- QuotePropertyNames: { value: true },
- FileName: { value: 'ar16_json' }
- },
- xml: {
- Encoding: { value: 'Unicode' },
- FileName: { value: 'ar16_xml' }
- },
- tiff: {
- /* only for rpx */
- Pagination: { value: false },
- CompressionScheme: { value: 'None' },
- /* only for rdlx */
- Compression: { value: 'None' },
- /*both (rdlx and rpx)*/
- Dither: { value: true },
- DpiX: { value: 150 },
- DpiY: { value: 140 },
- FileName: { value: 'ar16_tiff' }
- },
- rtf: {
- EnableShapes: { value: true },
- Pagination: { value: false },
- FileName: {
- value: 'ar16_mht'
- }
- },
- mht: {
- /* only for rdlx */
- Fragment: { value: true },
- OutputTOC: { value: false },
- LinkTarget: { value: '_top' },
- Mode: { value: 'Galley' },
- /* only for rpx */
- BookmarkStyle: { value: 'None' },
- CharacterSet: { value: 'Big5' },
- CreateFramesetPage: { value: true },
- IncludeHtmlHeader: { value: false },
- IncludePageMargins: { value: true },
- MultiPage: { value: true },
- OutputType: { value: 'LegacyHtml' },
- Pagination: { value: false },
- RemoveVerticalSpace: { value: true },
- Title: { value: 'TITLE_01' },
- /*both (rdlx and rpx)*/
- FileName: { value: 'ar16_mht' }
- },
- }
- });
复制代码 只需要修改对应的属性即可实现全部控制
快去试试吧
|