static void SetTextStyle(string& strXml, const TextStyle& style) { char pattern[32]; sprintf_s(pattern, "%06X", style.color); ReplaceString(strXml, pattern, STR_COLOR); sprintf_s(pattern, "%d", style.font_size); ReplaceString(strXml, pattern, STR_FONTSIZE); ReplaceString(strXml, style.underline ? "single" : "", STR_UNDERLINE); ReplaceString(strXml, GetAlignText(style.alignment), STR_TEXTALIGN); ReplaceString(strXml, style.bold ? "<w:b />" : "", STR_BOLD); ReplaceString(strXml, style.italic ? "<w:i />" : "", STR_ITALIC); ReplaceString(strXml, SysWideToMultiByte(style.font), STR_FONT); }
static void SetText(string& strXml, const wstring& text) { ReplaceString(strXml, SysWideToMultiByte(text), STR_TEXT); }
std::string SysWideToNativeMB(const std::wstring& wide) { return SysWideToMultiByte(wide, CP_ACP); }
// 不要再函数中使用断言, 因为断言代码中使用了该函数. std::string SysWideToUTF8(const std::wstring& wide) { return SysWideToMultiByte(wide, CP_UTF8); }
std::string SysWideToNativeMB(const std::wstring& wide_str) { return SysWideToMultiByte(wide_str, CodePage::Default_Code_Page); }
std::string SysWideToUTF8(const std::wstring& wide_str) { return SysWideToMultiByte(wide_str, CodePage::UTF8); }