You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PicoXLSX/Workbook.cs
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -983,7 +983,8 @@ public void Up()
983
983
/// Moves the cursor the number of defined rows up
984
984
/// </summary>
985
985
/// <param name="numberOfRows">Number of rows to move.</param>
986
-
/// <param name="keepColumnPosition">If true, the column position is preserved, otherwise set to 0.</param>
986
+
/// <param name="keepColumnPosition">If true, the column position is preserved, otherwise set to 0</param>
987
+
/// <remarks>An exception will be thrown if the row number is below 0. Values (number of rows) can be also negative. However, this is the equivalent of the function <see cref="Down(int, bool)"/></remarks>
Copy file name to clipboardExpand all lines: PicoXLSX/Worksheet.cs
+136Lines changed: 136 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,21 @@ public class Worksheet
80
80
/// </summary>
81
81
publicconstfloatMAX_ROW_HEIGHT=409.5f;
82
82
83
+
/// <summary>
84
+
/// Automatic zoom factor of a worksheet
85
+
/// </summary>
86
+
publicconstintAUTO_ZOOM_FACTOR=0;
87
+
88
+
/// <summary>
89
+
/// Minimum zoom factor of a worksheet
90
+
/// </summary>
91
+
publicconstintMIN_ZOOM_FACTOR=10;
92
+
93
+
/// <summary>
94
+
/// Maximum zoom factor of a worksheet
95
+
/// </summary>
96
+
publicconstintMAX_ZOOM_FACTOR=400;
97
+
83
98
/// <summary>
84
99
/// Enum to define the direction when using AddNextCell method
85
100
/// </summary>
@@ -146,6 +161,19 @@ public enum WorksheetPane
146
161
topLeft
147
162
}
148
163
164
+
/// <summary>
165
+
/// Enum to define how a worksheet is displayed in the spreadsheet application (Excel)
166
+
/// </summary>
167
+
publicenumSheetViewType
168
+
{
169
+
/// <summary>The worksheet is displayed without pagination (default)</summary>
170
+
normal,
171
+
/// <summary>The worksheet is displayed with indicators where the page would break if it were printed</summary>
172
+
pageBreakPreview,
173
+
/// <summary>The worksheet is displayed like it would be printed</summary>
174
+
pageLayout
175
+
}
176
+
149
177
/// <summary>
150
178
/// Defines the activeStyle
151
179
/// </summary>
@@ -276,6 +304,16 @@ public enum WorksheetPane
276
304
/// </summary>
277
305
privateintsheetID;
278
306
307
+
/// <summary>
308
+
/// Defines how the current worksheet is displayed in the spreadsheet application (Excel)
309
+
/// </summary>
310
+
privateSheetViewTypeviewType;
311
+
312
+
/// <summary>
313
+
/// Defines the zoom factors of the current worksheet for each view type
314
+
/// </summary>
315
+
privateDictionary<SheetViewType,int>zoomFactor;
316
+
279
317
/// <summary>
280
318
/// Gets the range of the auto-filter. Wrapped to Nullable to provide null as value. If null, no auto-filter is applied
281
319
/// </summary>
@@ -548,6 +586,66 @@ public Style ActiveStyle
548
586
get{returnactiveStyle;}
549
587
}
550
588
589
+
/// <summary>
590
+
/// Gets or sets whether grid lines are visible on the current worksheet. Default is true
591
+
/// </summary>
592
+
publicboolShowGridLines{get;set;}
593
+
594
+
/// <summary>
595
+
/// Gets or sets whether the column and row headers are visible on the current worksheet. Default is true
596
+
/// </summary>
597
+
publicboolShowRowColumnHeaders{get;set;}
598
+
599
+
/// <summary>
600
+
/// Gets or sets whether a ruler is displayed over the column headers. This value only applies if <see cref="ViewType"/> is set to <see cref="SheetViewType.pageLayout"/>. Default is true
601
+
/// </summary>
602
+
publicboolShowRuler{get;set;}
603
+
604
+
/// <summary>
605
+
/// Gets or sets how the current worksheet is displayed in the spreadsheet application (Excel)
606
+
/// </summary>
607
+
publicSheetViewTypeViewType
608
+
{
609
+
get
610
+
{
611
+
returnviewType;
612
+
}
613
+
set
614
+
{
615
+
viewType=value;
616
+
SetZoomFactor(value,100);
617
+
}
618
+
}
619
+
620
+
/// <summary>
621
+
/// Gets or sets the zoom factor of the <see cref="ViewType"/> of the current worksheet. If <see cref="AUTO_ZOOM_FACTOR"/>, the zoom factor is set to automatic
622
+
/// </summary>
623
+
/// <remarks>It is possible to add further zoom factors for inactive view types, using the function <see cref="SetZoomFactor(SheetViewType, int)"/> </remarks>
624
+
/// <exception cref="WorksheetException">Throws a WorksheetException if the zoom factor is not <see cref="AUTO_ZOOM_FACTOR"/> or below <see cref="MIN_ZOOM_FACTOR"/> or above <see cref="MAX_ZOOM_FACTOR"/></exception>
625
+
publicintZoomFactor
626
+
{
627
+
set
628
+
{
629
+
SetZoomFactor(viewType,value);
630
+
}
631
+
get
632
+
{
633
+
returnzoomFactor[viewType];
634
+
}
635
+
}
636
+
637
+
/// <summary>
638
+
/// Gets all defined zoom factors per <see cref="SheetViewType"/> of the current worksheet. Use <see cref="SetZoomFactor(SheetViewType, int)"/> to define the values
639
+
/// </summary>
640
+
publicDictionary<SheetViewType,int>ZoomFactors
641
+
{
642
+
get
643
+
{
644
+
returnzoomFactor;
645
+
}
646
+
}
647
+
648
+
551
649
/// <summary>
552
650
/// Initializes a new instance of the <see cref="Worksheet"/> class
/// Sets a zoom factor for a given <see cref="SheetViewType"/>. If <see cref="AUTO_ZOOM_FACTOR"/>, the zoom factor is set to automatic
2359
+
/// </summary>
2360
+
/// <param name="sheetViewType">Sheet view type to apply the zoom factor on</param>
2361
+
/// <param name="zoomFactor">Zoom factor in percent</param>
2362
+
/// <remarks>This factor is not the currently set factor. use the property <see cref="ZoomFactor"/> to set the factor for the current <see cref="ViewType"/></remarks>
2363
+
/// <exception cref="WorksheetException">Throws a WorksheetException if the zoom factor is not <see cref="AUTO_ZOOM_FACTOR"/> or below <see cref="MIN_ZOOM_FACTOR"/> or above <see cref="MAX_ZOOM_FACTOR"/></exception>
thrownewWorksheetException("The zoom factor "+zoomFactor+" is not valid. Valid are values between "+MIN_ZOOM_FACTOR+" and "+MAX_ZOOM_FACTOR+", or "+AUTO_ZOOM_FACTOR+" (automatic)");
2369
+
}
2370
+
if(this.zoomFactor.ContainsKey(sheetViewType))
2371
+
{
2372
+
this.zoomFactor[sheetViewType]=zoomFactor;
2373
+
}
2374
+
else
2375
+
{
2376
+
this.zoomFactor.Add(sheetViewType,zoomFactor);
2377
+
}
2378
+
}
2379
+
2244
2380
/// <summary>
2245
2381
/// Determines the next unused worksheet name in the passed workbook
0 commit comments