Disable Spellcheck ONLY in Calc?

Discuss the spreadsheet application
Post Reply
mc510
Posts: 6
Joined: Fri Jul 20, 2018 5:43 am

Disable Spellcheck ONLY in Calc?

Post by mc510 »

It's really distracting to have my spreadsheets covered with those wiggly red spellcheck underlines, especially since 99% of them are correct entries but are not actual words (i.e., the way people frequently use spreadsheets). But spellcheck is really useful in Writer, so I don't want to totally disable it. How can I turn it off in Calc but leave it enabled in Writer?
LibreOffice 6.0.5.2 on Windows 10
User avatar
Hagar Delest
Moderator
Posts: 32667
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Disable Spellcheck ONLY in Calc?

Post by Hagar Delest »

Hi and welcome to the forum!

See: [Solved] Turn off Spell check only in Calc.

Please add '[Solved]' at beginning of your first post title (edit button) if your issue has been fixed.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
mc510
Posts: 6
Joined: Fri Jul 20, 2018 5:43 am

Re: Disable Spellcheck ONLY in Calc?

Post by mc510 »

Thanks Hagar Delest. Sounds like the answer is that there's an easy way to toggle spellcheck on and off (from toolbar button), and an easy kludge to have Calc not show spellcheck marks in new spreadsheets that I create, but no way to just have spellcheck off for all Calc documents (including when I open a sheet that someone else created) and on for all Writer documents. Presumably no new way to do this has been introduced since that old (2009) thread. Seems odd to me, but I guess I'm an outlier.
LibreOffice 6.0.5.2 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Disable Spellcheck ONLY in Calc?

Post by Zizi64 »

There is an "another way" to switch off the spellcheck in a new or in an existing document.

The spellcheck function works only when the language of the cell is set to a language that has a spellcheck dictionary in the AOO/LO. You can create and set a new Default template with an adjusted Default cell style that is not assigned to any existing language of the AOO (option: "None").

In a well structured existing document the most of properties of the different cell styles are inherited from its parent style. Therefore (in most of cases) it is enough to set the language option of the Default cell style to "None" in an existing document.

You can find the option on the Font tab of the applied CELL STYLE.
Note: the manual formatting tab will adjust the properties of the selected cell/s/ only. You must adjust the Default cell style.
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.
mc510
Posts: 6
Joined: Fri Jul 20, 2018 5:43 am

Re: Disable Spellcheck ONLY in Calc?

Post by mc510 »

Zizi64 wrote:There is an "another way" to switch off the spellcheck in a new or in an existing document. The spellcheck function works only when the language of the cell is set to a language that has a spellcheck dictionary in the AOO/LO. You can create and set a new Default template with an adjusted Default cell style that is not assigned to any existing language of the AOO (option: "None").
In my testing, this approach works great for a new document that I create, but when I open a spreadsheet that was created by someone else then the spellcheck marks show up again.
LibreOffice 6.0.5.2 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Disable Spellcheck ONLY in Calc?

Post by Zizi64 »

but when I open a spreadsheet that was created by someone else then the spellcheck marks show up again.
It sounds strange for me. As I know it exactly, the state of the Spellcheck icon will not be stored into the document... If you switched OFF it once, an another document will not switch it on.
The Splellcheck icon on the Toolbar. You can switch OFF the spellcheck permanetly by one click.
The Splellcheck icon on the Toolbar. You can switch OFF the spellcheck permanetly by one click.
Spellcheck.png (11.36 KiB) Viewed 2627 times
Can you upload one of your problematic spreadsheet files?


And you can set the Spellcheck state of the applications differently in same time:
Spellcheck2.png
Last edited by Zizi64 on Sun Jul 22, 2018 7:07 am, edited 2 times 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.
mc510
Posts: 6
Joined: Fri Jul 20, 2018 5:43 am

Re: Disable Spellcheck ONLY in Calc?

Post by mc510 »

@Zizi64, my comment was about your suggestion to use a default template to "deactivate" spellcheck in Calc. It works, but only for files that I create, not for files created by others.

The toolbar button is curious. In my testing it is possible to have different settings in Calc and Word at the same time, but they don't persist when quitting and restarting the applications. It seems that whatever was the state in the last application to be closed, that will be the state in all applications that are restarted.
LibreOffice 6.0.5.2 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Disable Spellcheck ONLY in Calc?

Post by Zizi64 »

Here is an another approach, by usage of the macros:

I just recorded a macro, and then I completed it.
Save it into a module of the My Macros - Standard Library.
Then try to assign it to the event "Open document" of the Calc application. Use the Tools - Customize - Event tab of the function. Save this settings under the OpenOffice but not into the actual file.
Toggle_Spellcheck.png

The result:
The Spell check function will be switched ON - when you open an existing Writer document, and it will be switched OFF - when you open an existing Calc document. The newly created documents, and the other types of the documents will not be affected.


Code: Select all

REM  *****  BASIC  *****


sub Disable_SpellCheck
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame


dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "SpellOnline"

REM **************** remed by Zizi 64
args1(0).Value = false
REM ***************

REM **************** inserted by Zizi 64
If fnWhichComponent(document) = "Spreadsheet" then args1(0).Value = false
If fnWhichComponent(document) = "Text" then args1(0).Value = True
REM ****************

dispatcher.executeDispatch(document, ".uno:SpellOnline", "", 0, args1())

end sub


REM ...and here is a function from the site: https://wiki.openoffice.org/wiki/Currently_active_document
REM to determine which application was actually lanched.

function fnWhichComponent(oDoc) as string
if HasUnoInterfaces(oDoc, "com.sun.star.lang.XServiceInfo") then 
   if thisComponent.supportsService ("com.sun.star.text.GenericTextDocument") then
      fnWhichComponent = "Text"
   elseif thisComponent.supportsService("com.sun.star.sheet.SpreadsheetDocument") then
      fnWhichComponent = "Spreadsheet"
   elseif thisComponent.supportsService("com.sun.star.presentation.PresentationDocument") then
      fnWhichComponent = "Presentation"
   elseif thisComponent.supportsService("com.sun.star.drawing.GenericDrawingDocument") then
      fnWhichComponent = "Drawing"
   else
      fnWhichComponent = "Oops current document something else"
   end if
else
   fnWhichComponent = "Not a document"
end if
End function
I found the second part of the code on site:
https://wiki.openoffice.org/wiki/Curren ... e_document
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.
mc510
Posts: 6
Joined: Fri Jul 20, 2018 5:43 am

Re: Disable Spellcheck ONLY in Calc?

Post by mc510 »

Wow, thanks @Zizi64, I'll give that a try. Seems like it should work. Pretty kludgy though; do you think that the user community would appreciate a real setting feature to do this? I could request an enhancement ... but it seems like maybe most users are comfortable with the way spellcheck currently works?
LibreOffice 6.0.5.2 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11362
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Disable Spellcheck ONLY in Calc?

Post by Zizi64 »

... but it seems like maybe most users are comfortable with the way spellcheck currently works?
So, the the function is switchable on/off by one mouse click, therefore it never was a problem for me.
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.
mc510
Posts: 6
Joined: Fri Jul 20, 2018 5:43 am

Re: Disable Spellcheck ONLY in Calc?

Post by mc510 »

Turns out that an enhancement request already exists for this, so I've added a new comment.
https://bugs.documentfoundation.org/sho ... i?id=43789
LibreOffice 6.0.5.2 on Windows 10
Post Reply