

These actions will create a clickable button that will return you to your table of contents. Right-click the text box to select it, press Ctrl+K to launch the Insert Hyperlink dialog box, select Place in This Document (under the Link to menu), scroll down to Defined Names, select TOC, and press OK. Apply a hyperlink to your text box button.(In the example pictured below, I made the Text Box red, centered and bolded the text, applied a button effect, and applied a bottom right shadow.) Anywhere in the workbook, insert a Text Box (from the Insert tab's Shapes menu), label it Return to the Table of Contents, and format the button to your desire. This named location will be the cell where the navigational button created in the steps below will lead. Start by placing your cursor at the top of the table of contents and in the Name Box (located directly above column A), type TOC and press the Enter key. The advantage of this alternative approach is that the separate column of hyperlinks (such as column C in the example above) is not necessary, but the disadvantage is that each hyperlink must be applied one at a time.)įurther, I recommend you insert a button on each worksheet that will return you to your table of contents, as follows: (As an alternative, you could instead select each name in the table of contents one at a time and press Ctrl+K to apply a hyperlink directly to each worksheet name.

As a result, you will then be able to click each link to jump to the various worksheets listed in your table of contents. CellStyle = ( hlink_style ) FileStream sw = File. SetCellValue ( "Worksheet Link" ) link = new XSSFHyperlink ( HyperlinkType. SetCellValue ( "Target ICell" ) cell = sheet. CellStyle = ( hlink_style ) //link to a place in this workbook Email ) //note, if subject contains white spaces, make sure they are url-encoded SetCellValue ( "Email Link" ) link = new XSSFHyperlink ( HyperlinkType. CellStyle = ( hlink_style ) //e-mail linkĬell = sheet. SetCellValue ( "File Link" ) link = new XSSFHyperlink ( HyperlinkType. CellStyle = ( hlink_style ) //link to a file in the current directoryĬell = sheet. SetCellValue ( "URL Link" ) XSSFHyperlink link = new XSSFHyperlink ( HyperlinkType. CreateSheet ( "Hyperlinks" ) //URLĬell = sheet. SetFont ( hlink_font ) ICell cell ISheet sheet = workbook. CreateCellStyle () IFont hlink_font = workbook. //by default hyperlinks are blue and underlined IWorkbook workbook = new XSSFWorkbook () ////cell style for hyperlinks Number of columns, the number of columns in this hyperlink range.Number of rows, the number of rows in this hyperlink range.Cell name,the name of the cell the hyperlink will be added to.One version of the overloaded method takes the following parameters: The Add method works for both internal and external hyperlinks. It is possible to add hyperlinks to cells in the same Excel file by calling the Hyperlink collection’s Add method. Add ( "Target ISheet" ) HyperlinkCollection hyperlinks2 = sheet2. SetStyle ( style ) //link to a place in this workbook SetStyle ( style ) //link to a file in the current directory Hyperlinks Style style = new Style () style. Add ( "Hyperlinks" ) HyperlinkCollection hyperlinks = sheet. Workbook workbook = new Workbook () // Creating a Workbook object
