feature analysis: section columns#355
Conversation
|
@scanny, could you please review the proposed API? It would help a lot as I may get some time to move this feature forward over the weekend. Thanks! |
|
Hi @electron378, thanks for this, I've had a look over it. I'd say it's a great start. The main thing is it doesn't look like you've referred to the Microsoft API for Word (MS API). That turns out to be a critical piece of the puzzle for avoiding mis-steps in defining the python-docx API. If it's not immediately apparent how to do what I'm defining using the MS API, I search on something like "vba word section columns" and that will generally get me close enough to find what I'm looking for in the Word API reference: http://msdn.microsoft.com/en-us/library/office/ff837519.aspx In this case, it turns out to be critical, because it points to a shared object, a section = document.sections[-1]
page_setup = section.page_setup
text_columns = page_setup.text_columns
text_column = text_columns[0]
text_column.width = Inches(2)
text_column.space_after = Inches(0.25)This is the neighborhood in which to look in the Word API: https://msdn.microsoft.com/en-us/library/office/ff194295.aspx It looks like there is also a In general, I've found it best to mirror the MS API whenever possible, using pythonicized names. There are two parts to the rationale. First is that the designers put a lot of thought into it, more than we're likely to, and what they have works as a complete whole. This is a big plus, because we're adding on individual features incrementally, and its easy to "re"-design yourself into a box where you later have to change the API. Changing the API is the one big no-no in a library. Folks build things that depend on the API and if you change it you break their code. The second reason is because at least some folks are already familiar with the MS API, so might as well not make it any harder for them than necessary. |
|
Also make sure you include the relevant XML Schema excerpts. The XML schemas are in the code tree here: Most of the elements for this will probably be in |
Provides analysis page for section-columns feature (with a final intention to fix #167):