Skip to content

Commit d4b099f

Browse files
committed
Add preview notes
1 parent 1660704 commit d4b099f

File tree

1 file changed

+48
-39
lines changed

1 file changed

+48
-39
lines changed

docs/excel/excel-add-ins-worksheet-display.md

+48-39
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,46 @@ ms.localizationpriority: medium
99

1010
Excel is often used for reporting scenarios where you want to share worksheet data with others. Your Office Add-in can reduce visual clutter and help focus attention by controlling the appearance of the worksheet. The Office JavaScript API supports changing several visual aspects of the worksheet.
1111

12-
## Turn data type icons on or off
12+
## Page layout and print settings
13+
14+
Add-ins have access to page layout settings at a worksheet level. These control how the sheet is printed. A `Worksheet` object has three layout-related properties: `horizontalPageBreaks`, `verticalPageBreaks`, `pageLayout`.
15+
16+
`Worksheet.horizontalPageBreaks` and `Worksheet.verticalPageBreaks` are [PageBreakCollections](/javascript/api/excel/excel.pagebreakcollection). These are collections of [PageBreaks](/javascript/api/excel/excel.pagebreak), which specify ranges where manual page breaks are inserted. The following code sample adds a horizontal page break above row **21**.
17+
18+
```js
19+
await Excel.run(async (context) => {
20+
const sheet = context.workbook.worksheets.getActiveWorksheet();
21+
sheet.horizontalPageBreaks.add("A21:E21"); // The page break is added above this range.
22+
await context.sync();
23+
});
24+
```
25+
26+
`Worksheet.pageLayout` is a [PageLayout](/javascript/api/excel/excel.pagelayout) object. This object contains layout and print settings that are not dependent any printer-specific implementation. These settings include margins, orientation, page numbering, title rows, and print area.
27+
28+
The following code sample centers the page (both vertically and horizontally), sets a title row that will be printed at the top of every page, and sets the printed area to a subsection of the worksheet.
29+
30+
```js
31+
await Excel.run(async (context) => {
32+
const sheet = context.workbook.worksheets.getActiveWorksheet();
33+
34+
// Center the page in both directions.
35+
sheet.pageLayout.centerHorizontally = true;
36+
sheet.pageLayout.centerVertically = true;
37+
38+
// Set the first row as the title row for every page.
39+
sheet.pageLayout.setPrintTitleRows("$1:$1");
40+
41+
// Limit the area to be printed to the range "A1:D100".
42+
sheet.pageLayout.setPrintArea("A1:D100");
43+
44+
await context.sync();
45+
});
46+
```
47+
48+
## Turn data type icons on or off (preview)
49+
50+
> [!NOTE]
51+
> [!INCLUDE [Information about using preview APIs](../includes/using-excel-preview-apis.md)]
1352
1453
Data types can have an icon next to the value in the cell. When you have large tables with many data types, this can appear cluttered.
1554

@@ -30,7 +69,10 @@ await Excel.run(async (context) => {
3069
> [!NOTE]
3170
> If a linked data type displays a **?** icon, this can’t be toggled on or off. Excel needs the user to disambiguate the cell value to find the correct data type. For more information, see [Excel data types: Stocks and geography](https://support.microsoft.com/office/61a33056-9935-484f-8ac8-f1a89e210877).
3271
33-
## Show or hide the worksheet gridlines
72+
## Show or hide the worksheet gridlines (preview)
73+
74+
> [!NOTE]
75+
> [!INCLUDE [Information about using preview APIs](../includes/using-excel-preview-apis.md)]
3476
3577
Gridlines are the faint lines that appear between cells on a worksheet. These can be distracting if you use shapes, icons, or have specific line and border formats on data.
3678

@@ -48,7 +90,10 @@ await Excel.run(async (context) => {
4890
});
4991
```
5092

51-
## Toggle headings
93+
## Toggle headings (preview)
94+
95+
> [!NOTE]
96+
> [!INCLUDE [Information about using preview APIs](../includes/using-excel-preview-apis.md)]
5297
5398
Headings are the Excel row numbers that appear on the left side of the worksheet (1, 2, 3) and the column letters that appear at the top of the worksheet (A, B, C). The user may not want these in their report.
5499

@@ -64,42 +109,6 @@ await Excel.run(async (context) => {
64109
});
65110
```
66111

67-
## Page layout and print settings
68-
69-
Add-ins have access to page layout settings at a worksheet level. These control how the sheet is printed. A `Worksheet` object has three layout-related properties: `horizontalPageBreaks`, `verticalPageBreaks`, `pageLayout`.
70-
71-
`Worksheet.horizontalPageBreaks` and `Worksheet.verticalPageBreaks` are [PageBreakCollections](/javascript/api/excel/excel.pagebreakcollection). These are collections of [PageBreaks](/javascript/api/excel/excel.pagebreak), which specify ranges where manual page breaks are inserted. The following code sample adds a horizontal page break above row **21**.
72-
73-
```js
74-
await Excel.run(async (context) => {
75-
let sheet = context.workbook.worksheets.getActiveWorksheet();
76-
sheet.horizontalPageBreaks.add("A21:E21"); // The page break is added above this range.
77-
await context.sync();
78-
});
79-
```
80-
81-
`Worksheet.pageLayout` is a [PageLayout](/javascript/api/excel/excel.pagelayout) object. This object contains layout and print settings that are not dependent any printer-specific implementation. These settings include margins, orientation, page numbering, title rows, and print area.
82-
83-
The following code sample centers the page (both vertically and horizontally), sets a title row that will be printed at the top of every page, and sets the printed area to a subsection of the worksheet.
84-
85-
```js
86-
await Excel.run(async (context) => {
87-
let sheet = context.workbook.worksheets.getActiveWorksheet();
88-
89-
// Center the page in both directions.
90-
sheet.pageLayout.centerHorizontally = true;
91-
sheet.pageLayout.centerVertically = true;
92-
93-
// Set the first row as the title row for every page.
94-
sheet.pageLayout.setPrintTitleRows("$1:$1");
95-
96-
// Limit the area to be printed to the range "A1:D100".
97-
sheet.pageLayout.setPrintArea("A1:D100");
98-
99-
await context.sync();
100-
});
101-
```
102-
103112
## See also
104113

105114
- [Excel JavaScript object model in Office Add-ins](excel-add-ins-core-concepts.md)

0 commit comments

Comments
 (0)