API refactoring: write*() return boolean instead of integer
Fix potential crash when current sheet is not Worksheet
Eliminate some compile warnings