Return-Path: X-Original-To: apmail-poi-dev-archive@www.apache.org Delivered-To: apmail-poi-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 67F9E18219 for ; Fri, 2 Oct 2015 10:57:18 +0000 (UTC) Received: (qmail 10285 invoked by uid 500); 2 Oct 2015 10:57:18 -0000 Delivered-To: apmail-poi-dev-archive@poi.apache.org Received: (qmail 10234 invoked by uid 500); 2 Oct 2015 10:57:18 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 10217 invoked by uid 99); 2 Oct 2015 10:57:18 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Oct 2015 10:57:18 +0000 Received: from asf-bz1-us-mid.priv.apache.org (nat1-us-mid.apache.org [23.253.172.122]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPS id C81401A0046 for ; Fri, 2 Oct 2015 10:57:17 +0000 (UTC) Received: by asf-bz1-us-mid.priv.apache.org (ASF Mail Server at asf-bz1-us-mid.priv.apache.org, from userid 33) id CE0A760B93; Fri, 2 Oct 2015 10:57:16 +0000 (UTC) From: bugzilla@apache.org To: dev@poi.apache.org Subject: [Bug 58471] New: [PATCH] Format numbers more like Excel Date: Fri, 02 Oct 2015 10:57:16 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: SS Common X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cmb-apache@corefiling.co.uk X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bz.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 https://bz.apache.org/bugzilla/show_bug.cgi?id=58471 Bug ID: 58471 Summary: [PATCH] Format numbers more like Excel Product: POI Version: unspecified Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: SS Common Assignee: dev@poi.apache.org Reporter: cmb-apache@corefiling.co.uk Created attachment 33155 --> https://bz.apache.org/bugzilla/attachment.cgi?id=33155&action=edit Patch to format numbers more like Excel The current DataFormatter differs slightly from Excel's formatting, which is documented at https://support.microsoft.com/en-us/kb/65903 (Summary, 3rd sentence onward) regarding when to use scientific notation and counting the decimal point towards the character limit. It also differs on rounding mode, which in Excel appears to be HALF_UP (this does not appear to be documented). I attach a patch adding and using a new ExcelGeneralNumberFormat which matches Excel in a variety of test cases. This is useful for users who want to construct an error message quoting the cell value as it would be shown in Excel. Note that this all matches the longest string Excel will display given a sufficiently wide cell. In the default cell width, it uses a smaller number of characters, and I don't know if that number and/or the cell width vary with display settings/DPI, accessibility settings, available fonts, etc., so the wide-cell value seemed the best thing to target. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org