Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 89B01200CB0 for ; Fri, 9 Jun 2017 02:18:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8839C160BE5; Fri, 9 Jun 2017 00:18:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CBF6B160BD5 for ; Fri, 9 Jun 2017 02:18:24 +0200 (CEST) Received: (qmail 9422 invoked by uid 500); 9 Jun 2017 00:18:24 -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 9410 invoked by uid 99); 9 Jun 2017 00:18:23 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2017 00:18:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 544131A058C for ; Fri, 9 Jun 2017 00:18:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.679 X-Spam-Level: * X-Spam-Status: No, score=1.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 3O8eKUKGrtfY for ; Fri, 9 Jun 2017 00:18:22 +0000 (UTC) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id EC6005F6BE for ; Fri, 9 Jun 2017 00:18:21 +0000 (UTC) Received: by mail-it0-f50.google.com with SMTP id m62so131123517itc.0 for ; Thu, 08 Jun 2017 17:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=FiC2dbn26V6MKVjtIHkyQoQatrHVucn1rvoWHfkLG/U=; b=oqFJn1RNWl4m+TlcN/p065c5CGr3VUAH7ymbFASAYodEuzzwoTwrheH7Bfb4obSXHC 1Pk3LGquVlCgk/JN1PO2vFaUiLljHr0/sqF5oIcDuIIaVO7Y/cSfPZCTlqM8xh8CnDvv zuplZJ641FkMqEYXtpO7P2MuAsxDyKf/w5v2WHA/LTc3lJGRY+NLSuzr9xNhztRz/Gs6 25IKBF+8wm6C5T1FDwNPi/iOyACZ6cv6X+Kp8f235V8t/VGiSOHJseQ7f5LJSkMc2GPa SZylS1Zen7YFcliNB/wceiic20TyLs46Qbk64bsZNX1eVgNglqxAi40SfDkyHmTBaESG 6BUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FiC2dbn26V6MKVjtIHkyQoQatrHVucn1rvoWHfkLG/U=; b=h4kXS8Us1yt4JK7rUF46MXJxDrkGgqb2BGddspYIifffmjcElJxChlHvnzE4Mp5NT6 76GXvNR5Um35eAaRi6f8dPFND86XROixfeUXZGQjocBPAa1EvmWpgp/O/U4X3O40E3z9 /oS/cpLJNW12tOUZ0vZiD+i/cHOr2WgkB9PZ+tTiWAllO1/3zbAO3hrhnmqJgP14SL/g 2RS01bhDtxPsXEbtDjnT/L927GNESG9yKBxDUfEe3ajfP9QBZ/vsn3huCE2cwBAyQlcw GVR5/Pfo+xsh1m1g2qsjHwBYQN72A2Osvc81/XDkOSgCeffsL/PdvB6yx3qudIuBS3ER Cq9w== X-Gm-Message-State: AODbwcChtXhTxvQkNgchRSPLNAI/ulIUA4lNmkQJ3v7UuE4YTPqCSpJN lwdieW/ezwqeXTdgY/OrBFtIfh7JqR6h X-Received: by 10.36.28.75 with SMTP id c72mr8247620itc.26.1496967500956; Thu, 08 Jun 2017 17:18:20 -0700 (PDT) MIME-Version: 1.0 From: Greg Woolsey Date: Fri, 09 Jun 2017 00:18:10 +0000 Message-ID: Subject: Excel formula saving oddity To: POI Developers List Content-Type: multipart/alternative; boundary="001a1140573c22942d05517be840" archived-at: Fri, 09 Jun 2017 00:18:25 -0000 --001a1140573c22942d05517be840 Content-Type: text/plain; charset="UTF-8" I ran across this from a user file today, and hadn't seen it before. Chart series definitions default to just cell address ranges, but can be set to named ranges instead with some clicking and typing in the UI, which makes charts more dynamic. However, for unknown reasons not documented in Excel help as far as I can see, the named range reference has to be specified as: 'workbook file name.xlsx'!named_range however, when saving, the XML doesn't store the file name, but rather: [0]!named_range which of course is not recognized by POI's formula parsing. When opening the file back up in Excel, it replaces [0] with the file name again in the formulas. My question is, does it seem reasonable, when the expression fails to parse otherwise, to check if it starts with [0]! and if so, strip that off the input and try again? Could do this up front and not do a second pass, but I don't know if there is valid syntax that could start with that string somehow. This would just be for parsing, it wouldn't update the stored value, as that's needed for the next time Excel opens the file. Not quite sure how to support creating charts using this syntax in POI - I don't have to solve that problem for my current task, but it's an interesting one to consider. I suppose a user could just set the saved formula above and it would work. That would need documentation I suppose, but this Excel functionality is only documented in non-MS places. I suspect it is a side effect they didn't plan for, but have to support because it's being widely used. Greg --001a1140573c22942d05517be840--