From user-return-23316-archive-asf-public=cust-asf.ponee.io@poi.apache.org Fri Dec 21 00:57:17 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 0306A180648 for ; Fri, 21 Dec 2018 00:57:16 +0100 (CET) Received: (qmail 73543 invoked by uid 500); 20 Dec 2018 23:57:15 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 73525 invoked by uid 99); 20 Dec 2018 23:57:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Dec 2018 23:57:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id DAEF7C285B for ; Thu, 20 Dec 2018 23:57:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.202 X-Spam-Level: X-Spam-Status: No, score=-0.202 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id xNGYhmcbi2L4 for ; Thu, 20 Dec 2018 23:57:13 +0000 (UTC) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 10B885FDEE for ; Thu, 20 Dec 2018 23:57:13 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id c123so1677087pfb.0 for ; Thu, 20 Dec 2018 15:57:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Ge7J3TBHMDpGjRGjRJNgwHZQsGEK26HxntiZDfSIxbM=; b=RGdjqK5cnPOB0f0sYsrVMdArx9Sg1FXcgRF13lOeYxw4oWDscDDchhWUFQMPLS1PRw otOjtd1q742rFvjjbHh/u3muof66rOIGm6Oos3j8PORkJsYtzOXcdgVEZLHOIcSwGL93 9NN6oXKHK6IaZMRkiS1VnuAo50/g+0sUx5WvPpB8xRC7oVKSXJgHkC/BynIEo3Z93Yhg ZtEOBFyuBaHnvNedL8qlrgHQp3vtbpSRlFIduiMKpD02B6XQb9b99XwPaTCEzxErXdaZ htecQYd4fSLFp7T5h7RHbzJIKzFfWq+eGT2CqcZtjBFzPvQ2Y3jozXWCLUEM/bdcVbQJ RhhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Ge7J3TBHMDpGjRGjRJNgwHZQsGEK26HxntiZDfSIxbM=; b=ngz41OAQry5TPl5sUNruZYLl6twP4aVxrcwlgpHpigxCz4R2jommzdiAG15GtUh7Wx EFaKfLiyQiJT7Ir70aHpfDY6XMjGWY8WlfOxdae9Wmo24Hk6xcXooTykY5dGyXAyRqzf syQWs9CIvlwuDM20QYFoxVOfCGCtB8p9vxP8lvfWEnW7iQ7Vj9tqNDHPeEC3mNX5D+g9 bEqWeqJyQIgZuIjuZXtGYi9FPwildmiJOaLsNSceUL2dpPkvEVfDzc0wfDc/zkk+TqT3 10dCI7WPBNxgPJzmtLwE0BowjajJWYGWJL0pbIc6QplmVMQrFdGjjQqk/4V2IN8k9RCI 5+cg== X-Gm-Message-State: AJcUukfo+YykAVoBKqU7AHHsvmDZP4uxXRboNGprgJ1M0+wM3pGreS/s PsBUaoItorp6WSnp0YbdXWPsAcdF X-Google-Smtp-Source: ALg8bN61LMGxJ/mDeZ40VUQIC1wrYLW9M2bAO1/l0Fh0FdE12bRDDP1XF+ujQKLleEnVbMcT1VImZA== X-Received: by 2002:a62:c583:: with SMTP id j125mr249598pfg.37.1545350225913; Thu, 20 Dec 2018 15:57:05 -0800 (PST) Received: from [10.104.134.14] ([155.100.47.6]) by smtp.gmail.com with ESMTPSA id l64sm25975163pge.73.2018.12.20.15.57.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Dec 2018 15:57:05 -0800 (PST) Subject: Re: error setting style To: user@poi.apache.org References: <205ce70b-bc09-676d-fe39-affcd5b731a3@gmail.com> From: Rob Sargent Message-ID: <4f5b6b44-0ab2-6726-6fd9-8f4863a35976@gmail.com> Date: Thu, 20 Dec 2018 16:57:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Off to a "Lab party" just now, but I hope to get you some chunks of my app (as broken). On 12/20/18 4:53 PM, Greg Woolsey wrote: > I'm interested to see how you are creating the new sheet, wondering if > something lost a reference to the StylesTable somehow. Since I have code > that also manipulates styles and adds/removes cells, I'm interested to see > if a bug was introduced or documentation needs improving, or perhaps some > internal API is exposed without proper documentation or safety checks. > > Greg > > On Thu, Dec 20, 2018 at 3:05 PM Rob Sargent wrote: > >> I have circumvented the situation by using copyStyleFrom(). I posted >> because a) I'm setting styles on cell in a new sheet in the origin >> workbook - which to me contradicts the helpful hint and b) I had been >> doing exactly that in the recent pass. >> >> If you still want my code which generates the error I can back up a >> bit. The partial stack trace I sent was all lines not in my code. >> >> >> On 12/20/18 3:55 PM, Greg Woolsey wrote: >>> Can you provide a test case, sample code, or full stacktrace? How is the >>> new sheet created? It looks to me from the code that the message means >>> exactly what it says - the style you are trying to set and the cell you >> are >>> trying to set it on come from different Workbook objects. Both the style >>> and the cell hold a reference to the StylesTable object read from (or >>> created for) the Workbook in which they are found. POI doesn't support >>> directly assigning styles across Workbook instances. See this thread[1] >>> for a description of why, and what to do instead when you need to copy a >>> style between workbooks. >>> >>> Greg >>> >>> [1] >>> >> https://stackoverflow.com/questions/10773961/apache-poi-apply-one-style-to-different-workbooks >>> On Thu, Dec 20, 2018 at 11:58 AM Rob Sargent >> wrote: >>>> I'm using 4.0.1 as of this morning hoping this would help. I have >>>> recently begun to get: >>>> >>>> Exception in thread "main" java.lang.IllegalArgumentException: This >>>> Style does not belong to the supplied Workbook Styles Source. Are >>>> you trying to assign a style from one workbook to the cell of a >>>> different workbook? >>>> at >>>> >>>> >> org.apache.poi.xssf.usermodel.XSSFCellStyle.verifyBelongsToStylesSource(XSSFCellStyle.java:121) >>>> at >>>> >> org.apache.poi.xssf.usermodel.XSSFCell.setCellStyle(XSSFCell.java:667) >>>> and I am adding style to a cell in a new sheet, same workbook. The >>>> immediate code is not new and had been working (in 4.0.0). Not sure what >>>> change I made has caused this to start. >>>> >>>> I confess the original xlsx has been touched by LibreOffice/Calc and >>>> saved as xlsx. Linux file command reports: >>>> >>>> file '/home/u0138544/tools/reform/Compicated Query for Rob >> Tool.xlsx' >>>> /home/u0138544/tools/reform/Compicated Query for Rob Tool.xlsx: >>>> Microsoft OOXML >>>> >>>> Any suggestions appreciated. >>>> >>>> >>>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org >> For additional commands, e-mail: user-help@poi.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org