• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / displaytag / 1753

12 Feb 2026 03:17AM UTC coverage: 77.321% (-0.01%) from 77.334%
1753

push

github

web-flow
Merge pull request #1102 from hazendaz/renovate/javax-support-logback-monorepo

Update dependency ch.qos.logback:logback-classic to v1.5.29 (javax-support)

1438 of 2003 branches covered (71.79%)

Branch coverage included in aggregate %.

4034 of 5074 relevant lines covered (79.5%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/displaytag/src/main/java/org/displaytag/export/ExcelView.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2002-2026 Fabrizio Giustina, the Displaytag team
6
 */
7
package org.displaytag.export;
8

9
import org.apache.commons.lang3.StringUtils;
10
import org.apache.commons.lang3.Strings;
11

12
/**
13
 * Export view for excel exporting.
14
 */
15
public class ExcelView extends BaseExportView {
1✔
16

17
    /**
18
     * Gets the mime type.
19
     *
20
     * @return "application/vnd.ms-excel"
21
     *
22
     * @see org.displaytag.export.ExportView#getMimeType()
23
     */
24
    @Override
25
    public String getMimeType() {
26
        return "application/vnd.ms-excel"; //$NON-NLS-1$
1✔
27
    }
28

29
    /**
30
     * Gets the row end.
31
     *
32
     * @return the row end
33
     *
34
     * @see org.displaytag.export.BaseExportView#getRowEnd()
35
     */
36
    @Override
37
    protected String getRowEnd() {
38
        return "\n"; //$NON-NLS-1$
1✔
39
    }
40

41
    /**
42
     * Gets the cell end.
43
     *
44
     * @return the cell end
45
     *
46
     * @see org.displaytag.export.BaseExportView#getCellEnd()
47
     */
48
    @Override
49
    protected String getCellEnd() {
50
        return "\t"; //$NON-NLS-1$
1✔
51
    }
52

53
    /**
54
     * Gets the always append cell end.
55
     *
56
     * @return false
57
     *
58
     * @see org.displaytag.export.BaseExportView#getAlwaysAppendCellEnd()
59
     */
60
    @Override
61
    protected boolean getAlwaysAppendCellEnd() {
62
        return false;
1✔
63
    }
64

65
    /**
66
     * Gets the always append row end.
67
     *
68
     * @return false
69
     *
70
     * @see org.displaytag.export.BaseExportView#getAlwaysAppendRowEnd()
71
     */
72
    @Override
73
    protected boolean getAlwaysAppendRowEnd() {
74
        return false;
1✔
75
    }
76

77
    /**
78
     * Escaping for excel format.
79
     * <ul>
80
     * <li>Quotes inside quoted strings are escaped with a double quote</li>
81
     * <li>Fields are surrounded by " (should be optional, but sometimes you get a "Sylk error" without those)</li>
82
     * </ul>
83
     *
84
     * @param value
85
     *            the value
86
     *
87
     * @return the string
88
     *
89
     * @see org.displaytag.export.BaseExportView#escapeColumnValue(java.lang.Object)
90
     */
91
    @Override
92
    protected String escapeColumnValue(final Object value) {
93
        if (value != null) {
1!
94
            // quotes around fields are needed to avoid occasional "Sylk format invalid" messages from excel
95
            return "\"" //$NON-NLS-1$
1✔
96
                    + Strings.CS.replace(StringUtils.trim(value.toString()), "\"", "\"\"") //$NON-NLS-1$ //$NON-NLS-2$
1✔
97
                    + "\""; //$NON-NLS-1$
98
        }
99

100
        return null;
×
101
    }
102

103
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc