Skip to main content Skip to footer

What's New in GrapeCity Documents for Excel in v6.2

We are pleased to announce the new v6.2 release for GrapeCity Documents for Excel (GcExcel), our high-speed API library for creating Excel spreadsheets. This new release includes updates to the existing GcExcel .NET and Java libraries and API tools and additions to our JavaScript-based GrapeCity Documents Data Viewer. Have a look at the details of the release below.

GrapeCity Documents for Excel

SpreadJS .sjs file format support in GcExcel Java

With the v6.2 release, GcExcel adds support for SpreadJS file format ‘.sjs’ in its Java edition. The format helps to import/export spreadsheet features from SpreadJS ‘.sjs’ files to Excel or export of large files of popular formats such as xlsx, xlsm, csv, ssjson, etc., to ‘.sjs’ in lesser time and smaller in size.

The existing methods of GcExcel Java - open and save of the Workbook class have been enhanced to support .sjs files. While loading or saving a ‘.sjs’ file, you can use the new enum option “Sjs” in OpenFileFormat and SaveFileFormat enums.

Download GrapeCity Documents for Excel .NET and Java now!

With the support of the new file format, the following features will be supported -

  • Faster conversion of large Excel files to .sjs format.
  • Save exported files with a smaller footprint.
  • Import/Export Excel/SpreadJS features to/from SpreadJS.
  • Generate a single JSON string from the JSON files zipped in the .sjs file.
  • Customize opening and saving of SpreadJS .sjs files using various options available.

New classes SjsOpenOptions and SjsSaveOptions, have also been added, using which you can control which spreadsheet features to include/exclude while importing/exporting the ‘.sjs’ files.

The following code loads the SpreadJS .sjs file, turns off Formulas and Styles using SjsOpenOptions, and opens/saves the file using GcExcel:

// Create a new workbook
Workbook workbook = new Workbook();
InputStream stream = this.getResourceStream("sjs\\LoanDetails.sjs");

// OpenOptions for .sjs file format
SjsOpenOptions openOptions = new SjsOpenOptions();
openOptions.setIncludeFormulas(false);
openOptions.setIncludeStyles(false);

// GcExcel support using OpenOptions to open .sjs file format.
workbook.open(stream, openOptions);
    
// Save to a .sjs file
workbook.save("OpenSjsWithOpenOptions.sjs");

SpreadJS .sjs file format support in GcExcel Java

SpreadJS .sjs file format support in GcExcel Java

Have a look at the following resources to learn more about this format.

Help Java | Demo Java

Styles support in SpreadJS .sjs file format

GcExcel now also supports SpreadJS styles in importing and exporting .sjs files. The following new properties will be supported:

  • Style
    • buttonBackColor
    • hoverBackColor
    • watermark
    • Ellipsis
    • Cell Buttons
    • Dropdowns
    • Cell Padding
    • Label
  • Cell Types
    • Button Cell Type
    • CheckBoxCell Type
    • Check Box List Cell Type
    • Radio Button List Cell Type
    • Button List Cell Type
    • Range Template Cell Type
    • Combo Box Cell Type
    • HyperLink Cell Type

Help .NET | Help Java

Support for double-sided printing

At times it is possible to print a workbook with long worksheets sheets to be printed on both sides of a page. GcExcel .NET supports the Duplex enum in PrintOutOptions class to enable/disable double-sided printing on a page. There are four options in the enum that the user can use accordingly to print the workbook:

  • Duplex.Default indicates the printer's default duplex setting.
  • Duplex.Simplex indicates Single-sided printing.
  • Duplex.Vertical indicates the Double-sided, vertical printing.
  • Duplex.Horizontal indicates the Double-sided, horizontal printing.

The following code prints three copies of the workbook with double-sided vertical printing:

// Create a print options.
PrintOutOptions options = new PrintOutOptions();
// Set the printer name to print.
options.ActivePrinter = "[Real printer name]";
// Print 3 copies. 
options.Copies = 3;
//Set Double-sided, vertical printing.
options.Duplex = System.Drawing.Printing.Duplex.Vertical;

//Print this workbook to "Microsoft Print to PDF".
workbook.PrintOut(options);    

Help .NET | Demo .NET

Alignment options for Shape Text

GcExcel adds new TextAlignment property in the ITextRange interface that gets or sets the alignment of a text range or paragraph in a shape. This property sets the text alignment to left, right, center, distribute, and justify. This is helpful in scenarios where you have to align text for professional reports per UI design rules or align text per data formats, like text to left or numbers to right.

The following code sets the alignment of multiple paragraphs in a shape to Center and Left:

IShape shape = worksheet.Shapes.AddShape(AutoShapeType.RoundedRectangle, (double)10, (double)10, (double)320, (double)150);
shape.TextFrame.TextRange.TextAlignment = TextAlignmentAnchor.Left;
shape.TextFrame.TextRange.Font.Name = "Calibri";
shape.TextFrame.TextRange.Font.Size = 16;
shape.TextFrame.TextRange.Font.Color.RGB = Color.Black;
shape.TextFrame.TextRange.Font.Underline = TextUnderlineType.None;

shape.TextFrame.TextRange.Paragraphs.Add("Quarterly Results");
shape.TextFrame.TextRange.Paragraphs[0].TextAlignment = TextAlignmentAnchor.Center;
shape.TextFrame.TextRange.Paragraphs[0].Font.Size = 28;
shape.TextFrame.TextRange.Paragraphs[0].Font.Underline = TextUnderlineType.Single;
shape.TextFrame.TextRange.Paragraphs.Add("");

shape.TextFrame.TextRange.Paragraphs.Add("Business Domain: E-Commerce");
shape.TextFrame.TextRange.Paragraphs[2].TextAlignment = TextAlignmentAnchor.Left;

shape.TextFrame.TextRange.Paragraphs.Add("Quarter: Q4");
shape.TextFrame.TextRange.Paragraphs[3].TextAlignment = TextAlignmentAnchor.Left;

Alignment options for Shape Text

Help .NET | Demo .NET | Help Java | Demo Java

Set Vertical text direction in a Shape and Chart

In certain documents, it is desired to set the text orientation in the vertical direction. GcExcel adds the Direction property to API of shape and chart:

  • IShape.TextFrame.Direction to get or set the text direction of the shape.
  • ITickLabels.Direction to get or set the text direction of the tick labels on a chart axis.
  • IChartTitle.Direction or IChartTitle.TextFrame.Direction to get or set the text direction of the chart title.
  • IAxisTitle.Direction or IAxisTitle.TextFrame.Direction to get or set the text direction of the axis title.
  • IDataLabels.Direction to get or set the text direction of the data labels for the specified series.
  • IDataLabel.Direction or IDataLabel.TextFrame.Direction to get or set the text direction of the data label on a chart point.

The Direction property accepts the TextDirection enum option that helps to set the orientation of text in the following directions:

  • TextDirection.Horizontal indicates the text runs horizontally.
  • TextDirection.Vertical indicates the text runs vertically.
  • TextDirection.Rotate90 indicates the text will be rotated to a 90 angle.
  • TextDirection.Rotate270 indicates the text will be rotated to a 270 angle.
  • TextDirection.Stacked indicates the text will be stacked, and the text reading order is from left to right.
  • TextDirection.StackedRtl indicates the text will be stacked, and the text reading order is from right to left.

The following code sets the TextDirection of JP text to a Stacked direction:

var shape = worksheet.Shapes.AddShape(AutoShapeType.Rectangle, worksheet.Range["C2:F12"]);
shape.TextFrame.TextRange.Add("グレープシティへようこそ");

//Set the text direction to be stacked, and the text reading order from right to left.
shape.TextFrame.Direction = TextDirection.Stacked;

Set Vertical text direction in a Shape and Chart

Help .NET | Demo Shape .NET | Demo Chart .NET | Help Java | Demo Shape Java | Demo Chart Java |

GrapeCity Documents Data Viewer

Load SpreadJS .sjs files

In the last release, GcExcel .NET added support for the import and export of SpreadJS .sjs files, and with the v6.2 release, we now extend this support to GcDataViewer. You can open the SpreadJS .sjs files through the UI of the viewer or client-side code.

SpreadJS .sjs file opened through UI

In the ‘Select Data file’ (Open) dialog of the viewer, Data Type now accepts the SJS file type. The file Source can be Local or Remote.

SpreadJS .sjs file opened through UI

Help | Demo

SpreadJS file opened through client-side API

The ‘openFile’ method has been updated to accept FileType.SJS enum value in the second parameter, as well as new ‘SjsOpenOptions’ in the openOptions (third) parameter. The new SjsOpenOptions have been added to the client-side API, which helps to provide certain SpreadJS features to load while opening the .sjs file. The following client-side code opens a .sjs file:

var viewer;
var sjs_OpenOptions = {
    showHiddenSheets: true,
    showHiddenRows: false,
    showHiddenColumns: true,
    keepRowGroups: false,
};

function loadFile(fileUrl) {
     fetch(fileUrl).then(response => {
         response.blob().then(res => {
             viewer.openFile(res, FileType.SJS, sjs_OpenOptions);
         });
     })            
 }
 window.onload = function () {
     viewer = new GcDataViewer("#viewer");
     loadFile("/Files/12-month cash flow statement.sjs");
 }

Help | Demo

Keyboard shortcuts

GcDataViewer supports several keyboard shortcuts, which can make working with the viewer and cell operations more efficient. Please refer to the list of Keyboard shortcuts supported in the Help link below.

Help

Numerical Count aggregation in the status bar

GcDataViewer now supports numerical count aggregation in the status bar. When a file is loaded, and cells are selected, GcDataViewer will show the count of cells having numerical data. The following snapshot shows a cell range selected where three cells have numerical data:

Numerical Count aggregation in the status bar

Help

Download GrapeCity Documents for Excel .NET and Java now!

 

comments powered by Disqus