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;
020import javax.servlet.http.HttpServletRequest;
021
022import org.apache.poi.ss.usermodel.Workbook;
023import org.apache.poi.xssf.usermodel.XSSFWorkbook;
024
025/**
026 * Convenient superclass for Excel document views in the Office 2007 XLSX format
027 * (as supported by POI-OOXML). Compatible with Apache POI 3.5 and higher.
028 *
029 * <p>For working with the workbook in subclasses, see
030 * <a href="https://poi.apache.org">Apache's POI site</a>.
031 *
032 * @author Juergen Hoeller
033 * @since 4.2
034 */
035public abstract class AbstractXlsxView extends AbstractXlsView {
036
037        /**
038         * Default Constructor.
039         * <p>Sets the content type of the view to
040         * {@code "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}.
041         */
042        public AbstractXlsxView() {
043                setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
044        }
045
046        /**
047         * This implementation creates an {@link XSSFWorkbook} for the XLSX format.
048         */
049        @Override
050        protected Workbook createWorkbook(Map<String, Object> model, HttpServletRequest request) {
051                return new XSSFWorkbook();
052        }
053
054}