[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.