将带标签的值输出到Excel文件 [英] Output labelled values to excel file

查看:77
本文介绍了将带标签的值输出到Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的程序中,我输出一个.csv文件的值.现在,我输出的计算值不带任何标签:

在功能上:-

Hi all,

In my program, I output values an .csv file. Now I output the calculated values without any labels: i.e;

In function:-

CString function(double const& val1, double const& val2, double const& val1) 
{
CString str1, str2, str3; 
//Do some calculations and append the values to the strings

return  str1 +  _T("\n") + str2 +  _T("\n") + str3;
}


这给了我这样的输出:
$ 101
220m
330m
但我想在两栏中添加带有标签的标签:

ID | $ 101
distance1 | 220m
距离2 | 330m

(我仅使用"|"来复制列.)

如果我将标题和值一起输出,即;


This gives me the output like:
$101
220m
330m
But I want to out put this with labels in 2 columns:

Id | $101
distance1 | 220m
Distance2 | 330m

(I have used "|" only to replicate a column..)

If I output heading along with values,i.e;

CString heading1 = _T("Id:") ;
return heading1 + str1 + _T("\n")...................


输出显然是:"Id:$ 101"
两者都在同一列中,并且被视为一个字符串.如何在用逗号分隔的values(.csv)文件的2列中显示它们?


The output is obviously :" Id: $101"
Both are in a single column and is considered to be one string. How can I display them in 2 columns, in a comma separated values(.csv) file?

推荐答案

101
220m
330m
但我想在两栏中添加带有标签的标签:

ID |
101
220m
330m
But I want to out put this with labels in 2 columns:

Id |


101
distance1 | 220m
距离2 | 330m

(我仅使用"|"来复制列.)

如果我将标题和值一起输出,即;
101
distance1 | 220m
Distance2 | 330m

(I have used "|" only to replicate a column..)

If I output heading along with values,i.e;
CString heading1 = _T("Id:") ;
return heading1 + str1 + _T("\n")...................


输出显然是:"Id:


The output is obviously :" Id:


101"
两者都在同一列中,并且被视为一个字符串.如何在以逗号分隔的values(.csv)文件中的两列中显示它们?
101"
Both are in a single column and is considered to be one string. How can I display them in 2 columns, in a comma separated values(.csv) file?


这篇关于将带标签的值输出到Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆