[Python plugin] Use xlwings to insert the plugin solution (forked version) and xlwingsforked

Source: Internet
Author: User

[Python plugin] Use xlwings to insert the plugin solution (forked version) and xlwingsforked

Up to today, xlwings has not provided the solution insertion function.

Go to Github Pull Requests of the original producer

He said that someone had suggested to add this function, but he hasn't updated it yet ~

If you need to use Python to insert the handler solution, you can use the xlwings generated by forked.

The usage is as follows:

From xlwings import Workbook, Sheet, Range, Chartwb = Workbook (r 'excel tutorial route') wb = Workbook. caller () # extract x = Range ('a1 '). commentprint x # Use xlwings to insert the partial solution Range ('b5 '). comment = u' 文'

 

I made the following changes to the original xlwings:

In the xlwings/_ xlwindows. py audit case, I added the following

def get_comment(xl_range):    try:        xl_range.Comment.Text()            except:        return "None"def set_comment(xl_range, value):        xl_range.ClearComments()    xl_range.AddComment()    xl_range.Comment.Visible = True    value=(value).decode('utf-8')    xl_range.Comment.Text(value)

After the commit xlwings/main. py line 877, I added the following

@property    def comment(self):        return xlplatform.get_comment(self.xl_range)            @comment.setter    def comment(self, value):        xlplatform.set_comment(self.xl_range, value)

 

In this way, xlwings will be used to test my previous article [Python learning logs] Using Python to insert an example in Excel.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.