[Solved] Automatically capitalize cell content like title

Discuss the spreadsheet application
Post Reply
WolfAmri
Posts: 6
Joined: Sun Sep 26, 2021 7:02 pm

[Solved] Automatically capitalize cell content like title

Post by WolfAmri »

Hi everyone!
Please help, I have a spreadsheet for footage files with 4000 rows. Each row contains a title, description, and keywords. Not being native English, I didn't format the title grammatically correctly. Now I have to change that.
I know about the formula "PROPER()", but that would just capitalize the first letter of every word, which is not grammatically correct.

My procedure now is:
  • - copy the title
  • - go to a website that auto-formats the title (https://capitalizemytitle.com)
  • - paste it there
  • - copy it from there
  • - go back to the spreadsheet and replace the original by pasting it
As you can imagine that is pretty cumbersome for 4000 rows. So I wonder: is there any automation I can do, to have cells convert to grammatically correct titles?

Thanks in advance for any help!
Last edited by Hagar Delest on Mon Sep 27, 2021 7:16 pm, edited 1 time in total.
Reason: Tagged [Solved].
Open Office 4.1.9
Mac OS 11.4
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Automatically capitalize cell content like title

Post by Zizi64 »

Do you want to capitalize all of the letters, or you want to use Small Caps formatting property?
Last edited by Zizi64 on Mon Sep 27, 2021 4:05 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
WolfAmri
Posts: 6
Joined: Sun Sep 26, 2021 7:02 pm

Re: Automatically capitalize cell content like title

Post by WolfAmri »

Thanks, I would need it grammatically correct.

For example PROPER() would create
A Fox Is Red And Not Green
But correct (according to dedicated websites) would be:
A Fox Is Red and Not Green
Open Office 4.1.9
Mac OS 11.4
User avatar
MrProgrammer
Moderator
Posts: 4908
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Automatically capitalize cell content like title

Post by MrProgrammer »

WolfAmri wrote:I would need it grammatically correct.
OpenOffice does not have that feature. The requirement is complex because OpenOffice supports more than 40 languages, and grammar rules differ among them.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
WolfAmri
Posts: 6
Joined: Sun Sep 26, 2021 7:02 pm

Re: Automatically capitalize cell content like title

Post by WolfAmri »

MrProgrammer wrote:
WolfAmri wrote:I would need it grammatically correct.
OpenOffice does not have that feature.
Too bad. Thanks for your help though.
Open Office 4.1.9
Mac OS 11.4
gpgrego
Posts: 39
Joined: Fri Jan 31, 2020 4:04 pm

Re: Automatically capitalize cell content like title

Post by gpgrego »

You can try to implement that function with a custom macro.
See this example.
Attachments
APA_STYLE_TitleCase.ods
(39.03 KiB) Downloaded 131 times
openoffice 4.1.6 - Windows 10
WolfAmri
Posts: 6
Joined: Sun Sep 26, 2021 7:02 pm

Re: Automatically capitalize cell content like title

Post by WolfAmri »

Wow! Thank you so much. I looked at the code and tried to understand, but didn't. However, I just converted all the titles with your help and copy/pasted it into the other document. Very much appreciated. You saved me a huge lot of time!!!
Open Office 4.1.9
Mac OS 11.4
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [Solved] Automatically capitalize cell content like titl

Post by Zizi64 »

Code: Select all

    xSearch = " Up"
    iPos = InStr(MyTitleCase, xSearch)
    if iPos > 0 then
     sResult = Replace(sResult, xSearch, " Up")
    end if

    xSearch = " Up "
    iPos = InStr(MyTitleCase, xSearch)
    if iPos > 0 then
     sResult = Replace(sResult, xSearch, " up ")
    end if
(Sorry, my native language is not English.)
The word "Up" at the end of a sentence must be started with uppercase letter "U" in a Title, or is it a typo in your macro code?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Automatically capitalize cell content like titl

Post by Villeroy »

Is there any Python library which can do this correctly?
Indeed, there is: https://pypi.org/project/titlecase/
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] Automatically capitalize cell content like titl

Post by Lupp »

I will act as "The Rebel" in this case:

Imo there isn't legitimate authority concerning the orthography of titles.
It's the same in many different cases where teaching and "guides" and whatever pretend to know how something "must" be done. Nowadays software comes in with specifically silly ways of "proof reading", and of text manipulation.

Any language developed to its current states (plural!) and will not stop to develop because somebody wrote a book about its rules. This is very much true for English as a global language of understanding ("Lingua Franca").

Take pride in writing titles the way you think it's good and clever! Take part this way in creating the next -and better- standard.

....And start to obey standards (SI units, ISO concerning numbers and dates, ...) where they are really useful and well considered by experts.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
WolfAmri
Posts: 6
Joined: Sun Sep 26, 2021 7:02 pm

Re: [Solved] Automatically capitalize cell content like titl

Post by WolfAmri »

Lupp wrote:I will act as "The Rebel" in this case:

Imo there isn't legitimate authority concerning the orthography of titles.
It's the same in many different cases where teaching and "guides" and whatever pretend to know how something "must" be done. Nowadays software comes in with specifically silly ways of "proof reading", and of text manipulation.

Any language developed to its current states (plural!) and will not stop to develop because somebody wrote a book about its rules. This is very much true for English as a global language of understanding ("Lingua Franca").

Take pride in writing titles the way you think it's good and clever! Take part this way in creating the next -and better- standard.

....And start to obey standards (SI units, ISO concerning numbers and dates, ...) where they are really useful and well considered by experts.
Thanks for your opinion, but I'm afraid I have to use these standards because they are requested.
Open Office 4.1.9
Mac OS 11.4
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved] Automatically capitalize cell content like titl

Post by RoryOF »

Careful proof-reading, which should be standard for any document, ought find any irregularities so you can correct them.

It is _your_ responsibility to have the document correct before you submit it; you should not rely on any program to do your thinking for you.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
WolfAmri
Posts: 6
Joined: Sun Sep 26, 2021 7:02 pm

Re: [Solved] Automatically capitalize cell content like titl

Post by WolfAmri »

Villeroy wrote:Is there any Python library which can do this correctly?
Indeed, there is: https://pypi.org/project/titlecase/
Thank you!!!
Open Office 4.1.9
Mac OS 11.4
Post Reply