首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >导出到xojo中的文本

导出到xojo中的文本
EN

Stack Overflow用户
提问于 2018-04-23 08:07:17
回答 1查看 361关注 0票数 2

我想从一个列表框导出数据,

添加"001“、"Orange”、"1.00“、"Arief”“Listbox1.001”、"Apple“、"1.00”、"Arief“Listbox1.AddRow "001”、"Banana“、"1.00”、"Arief“Listbox1.添加"004”、"Orange“、"1.00”、"Arief“Listbox1.AddRow "005”、"Apple“、"1.00”、"Brandon“”Listbox1.AddRow“、"006”、"Banana“、"1.00","Brenda“dim f作为折页项,TextOutputStream f=新折叠项(”item.txt“) tisx = f.CreateTextFile dim Last_first_word作为字符串dim maxRow as integer = Listbox1.listcount-1作为整数=0,maxRow如果为Listbox1.cell(行,0)<> Last_first_word,则tisx.WriteLine”tisx.writeline listBox1.cell(行,0)listBox1.cell(行,0)listBox1.cell(行,行)+“+”+listBox1.cell 1.单元格(行,2)Last_first_word=Listbox1.Cell(行,0) tisx.WriteLine listBox1.cell 1.单元格(行,1)+“+listBox1.cell 1.单元格(行,2)如果下一个tisx.Close结束

我想分类所有具有相同代码的项目,并将名称放在最后。如何做出这样的结果,

001 Orange 1.00 Apple 1.00 Banana 1.00 Arief 004 Orange 1.00 Arief 005 Apple 1.00 Brandon 006 Banana 1.00 Brenda

谢谢

致以敬意,

阿里夫

EN

回答 1

Stack Overflow用户

发布于 2018-05-15 16:24:07

您还需要保存名称,以便在移到新的数据组之前显示它。只需要对代码稍加修改:

代码语言:javascript
复制
Listbox1.DeleteAllRows

ListBox1.AddRow("001", "Orange", "1.00", "Arief")
ListBox1.AddRow("001", "Apple", "1.00", "Arief")
ListBox1.AddRow("001", "Banana", "1.00", "Arief")
ListBox1.AddRow("004", "Orange", "1.00", "Arief")
ListBox1.AddRow("005", "Apple", "1.00", "Brandon")
ListBox1.AddRow("006", "Banana", "1.00", "Brenda")

Dim f As FolderItem
Dim tisx As TextOutputStream
f = SpecialFolder.Desktop.Child("item.txt")
tisx = f.CreateTextFile
Dim Last_first_word As String
Dim lastName As String
Dim maxRow As Integer = Listbox1.ListCount - 1
For row As Integer =  0 To maxRow
  If Listbox1.Cell(row, 0) <> Last_first_word Then
    If lastName <> "" Then tisx.WriteLine(lastName)

    tisx.WriteLine("")
    tisx.WriteLine(ListBox1.Cell(row, 0))
    tisx.WriteLine(ListBox1.Cell(row, 1) + " " + ListBox1.Cell(row, 2))
    Last_first_word = ListBox1.Cell(row, 0)
    lastName = ListBox1.Cell(row, 3)
  Else
    tisx.WriteLine(ListBox1.Cell(row, 1) + " " + ListBox1.Cell(row, 2))
  End If
Next

If lastName <> "" Then tisx.WriteLine(lastName)

tisx.Close

数据必须按照组号进行排序,这样才能正常工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49976204

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档