Spaces:
Running
Update app.py
Browse filescommented out line 482 and added
hebrew_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18px !important; color: #000000 !important; text-align: right !important; vertical-align: middle; padding-top: 0.069in !important; padding-bottom: 0.069in !important; padding-left: 0.069in !important; padding-right: 0.069in !important; {base_cell}"
Gemini: (its previous suggestion didn't change diddy squat) Don't beat yourself up! You are troubleshooting a highly specific rendering glitch between raw HTML and how Google Docs interprets clipboards. It's an absolute nightmare even for people who code in Python all day.
Looking closely at your new screenshot, the padding didn't budge at all. That tells us that Google Docs is completely ignoring the padding-right style on that cell, most likely because the parent <tr> or <table> tag has a property overriding it, or because Google Docs requires padding to be declared on all four sides as a single rule to recognize it when direction: rtl is present.
Let's try a different, more absolute surgical approach. Instead of adding a completely new CSS command, let's look at the actual base_cell variable where your padding is currently being generated.
The Real Culprit
Look back at Line 465 (right above the Hebrew cell style line). Your script currently defines base_cell like this:
Python
base_cell = "border: 1pt solid #b7b7b7; padding: 0.069in !important; height: auto; overflow: hidden; white-space: normal !important; word-wrap: break-word !important; box-sizing: border-box !important;"
Notice that padding: 0.069in !important; is applied globally to every cell type. If Google Docs is eating the right-side padding specifically on the Hebrew text, we can change the shorthand padding property into individual, explicit padding properties for all four sides on that specific Hebrew cell row. This overrides how Google Docs treats the RTL layout calculation.
The Absolute Fix
Let's undo the change we made to hebrew_cell_style previously, and instead rewrite Line 466 to explicitly declare individual padding for the top, bottom, left, and right sides.
Change Line 466 so that it looks exactly like this:
Python
hebrew_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18px !important; color: #000000 !important; text-align: right !important; vertical-align: middle; padding-top: 0.069in !important; padding-bottom: 0.069in !important; padding-left: 0.069in !important; padding-right: 0.069in !important; {base_cell}"
Why this forces it to work
When you use shorthand padding: 0.069in;, Google Docs tries to map it to its own internal table properties. If it encounters a right-aligned RTL cell, it sometimes drops the right value completely during translation. By explicitly passing padding-right: 0.069in !important; alongside the top, bottom, and left variants, you leave zero room for interpretation. Google Docs is forced to respect every single boundary layer.
Give that exact rewrite a shot. We're going to squeeze that text away from the border one way or another!
478 unmodified lines479480481482482483484485486298 unmodified lines785786787788789790478 unmodified lines ) base_cell = "border: 1pt solid #b7b7b7 !important; padding: 0.069in !important; height: auto; overflow: hidden; white-space: normal !important; word-wrap: break-word !important; box-sizing: border-box !important;" hebrew_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18px !important; color: #000000 !important; text-align: right !important; vertical-align: middle; padding-right: 0.069in !important;{base_cell}" # hebrew_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18px !important; color: #000000 !important; text-align: right !important; vertical-align: middle; padding-right: 0.069in !important;{base_cell}" hebrew_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18px !important; color: #000000 !important; text-align: right !important; vertical-align: middle; padding-top: 0.069in !important; padding-bottom: 0.069in !important; padding-left: 0.069in !important; padding-right: 0.069in !important; {base_cell}" english_cell_style = f"font-family: Arial, sans-serif !important; font-size: 11px !important; color: #000000 !important; text-align: center !important; vertical-align: top; line-height: 1.0 !important; {base_cell}" strongs_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18px !important; color: #000000 !important; text-align: center !important; vertical-align: middle; line-height: 1.15 !important; {base_cell}" heading_cell_style = f"font-family: 'Times New Roman', serif !important; font-size: 18px !important; color: #000000 !important; text-align: center !important; vertical-align: middle; line-height: 1.0 !important; {base_cell}"298 unmodified lines ) clear_btn.click(fn=None, inputs=[], outputs=[text_string_input], js="() => ''") copy_btn.click(fn=None, js=copy_btn_js)
demo.queue().launch(server_name="0.0.0.0", server_port=7860, css=custom_css)