I would like to know whether standing up or crouching down when you are in an enemy's attack range generates a reaction; would leaving their attack range would do so as well?
Strictly adhering to the rules: yes, it can generate a reaction.
In general, if the enemy you're facing used their Action to Ready an action (e.g., cast Hold person) choosing as a trigger "as soon as Jesus' characters stands up", then they can use their reaction while you're still within their reach.
Standing up or crouching does not provokes an opportunity attack while remaining in opponent's reach
If instead you mean "does standing up or crouching provoke an opportunity attack?" then the answer is a solid no.
The rules says that an opportunity attack is triggered when you're leaving the reach of the opponent: this is not the case, hence no opportunity attack takes place.
If you use half of your movement to stand up and then move out of opponent's reach, then the enemy can use their reaction (if available) to make an opportunity attack.
As pointed out in the comments by Kirt, falling prone may put you out of the opponent's reach if they are on a ledge above you: problem is that the rules are tailored for 2 dimensional combat, hence there is little support to 3D cases. For example, does the enemy that is staying on the ledge above you can (try to) hit you or do they have to crouch down to reach you? Or just having the high ground provides even advantage to attacks?
The 3D case needs DM's rulings.
No, only moving out of reach causes opportunity attacks
The PHB says about opportunity attacks (p. 195):
You can make an opportunity attack when a hostile creature that you can see moves out of your reach.
A creature that crouches down or stands up from prone does not move out of your reach, so these actions do not cause opportunity attacks.