001/*
002 * Copyright 2002-2015 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.servlet.view.document;
018
019import java.util.Map;
020
021import javax.servlet.http.HttpServletRequest;
022
023import org.apache.poi.ss.usermodel.Workbook;
024import org.apache.poi.xssf.usermodel.XSSFWorkbook;
025
026/**
027 * Convenient superclass for Excel document views in the Office 2007 XLSX format
028 * (as supported by POI-OOXML). Compatible with Apache POI 3.5 and higher.
029 *
030 * <p>For working with the workbook in subclasses, see
031 * <a href="https://poi.apache.org">Apache's POI site</a>.
032 *
033 * @author Juergen Hoeller
034 * @since 4.2
035 */
036public abstract class AbstractXlsxView extends AbstractXlsView {
037
038        /**
039         * Default Constructor.
040         * <p>Sets the content type of the view to
041         * {@code "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}.
042         */
043        public AbstractXlsxView() {
044                setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
045        }
046
047        /**
048         * This implementation creates an {@link XSSFWorkbook} for the XLSX format.
049         */
050        @Override
051        protected Workbook createWorkbook(Map<String, Object> model, HttpServletRequest request) {
052                return new XSSFWorkbook();
053        }
054
055}