Make the sleep timer on a tablet dependent on whether it's being charged or not Is there a way to set the sleep mode timer depending on whether the tablet is being charged or not? 

I normally have my Android tablet (Xoro Pad 9718, Android version 4.1.1) next to my computer on the desktop, and I like having some manual page or similar on the tablet while I'm working on the computer. In this case, the tablet is plugged into the charger, and I set the sleep mode to as long as possible, because it's just annoying if the screen turns black every few minutes. When the tablet is NOT plugged into the charger, I want a sleep mode timer of 30 seconds or one minute, to save battery life.

I'm open to a hidden setting somewhere as well as an app that detects when the charger is plugged/unplugged and changes the timer setting.
There is no such feature on Android natively.

However, there are quite a few "automation" type apps that can do this for you.  Some of the better known ones are Tasker, AutomateIt, Locale and Llama.  All of these allow you to define a trigger (e.g. "charger plugged in" in your case) and set up various actions such as toggling settings.

Keep in mind that most of these apps require excessive permissions in order to be able to change system settings (and some toggles even require root.)

Also, some manufacturer UI overlays and custom ROMs allow you to set up profiles with different settings.  Switching these profiles is either a manual process, or does not provide such granularity in configuration as the automation apps.