OnDrive is cloud storage, so it's remotely hosted space that won't be lost when you format your PC. You'll just need to use the same credentials to log-in again and access your files. Generally speaking, that means use the same Microsoft account to log in to Windows 10 after the re-install.