Comments (4)
excel 的结构每一行是一行数据,导出时自然就是一个数组的结构,如果有一列是主键的话,可以在读取导出配置时,将数组映射到字典,proton 只是一个导出工作,不涉及这部分工作。这部分工作可以在自动生成读取的代码框架中处理。
‘’‘
在自动生成的配置读取代码的框架中可通过继承的方式在派生类中进行检查、关联、重组织表结构等,具体可参考CSharpGeneratorForProton
’‘’
https://github.com/yanghuan/CSharpGeneratorForProton
from proton.
def newline(count):
return '\n' + ' ' * count
if isinstance(obj, int) or isinstance(obj, float) or isinstance(obj, str):
yield json.dumps(obj, ensure_ascii = False)
else:
indent += 1
yield '{'
islist = isinstance(obj, list)
isfirst = True
for i in obj:
if isfirst:
isfirst = False
else:
yield ','
yield newline(indent)
if not islist:
k = i
i = obj[k]
yield k
yield ' = '
for part in tolua(i, indent):
yield part
indent -= 1
yield newline(indent)
yield '}' 在生成lua的时候 貌似是从这里生成的! 我在/CSharpGeneratorForProton没有发现有生成的相关内容呀!
from proton.
你能不能提供一个!lua的话 加入不提供设置主键的话 有的时候还是很有局限性的
from proton.
在导出工具中提供这个功能是不合理的,这个是需要在读取时,自己做结构变换,将数组变换成字典,我项目中读取lua 时这么处理
“”“
local array = LoadTemplate("HerosTemplate")
HerosConf = TemplateToConfTable(array, function (i)
return i.Id
end)
”“”
你可能还需要进行检查、关联、重组织表结构,这些功能不适合在导出工具中提供,都需要你你在读取时
自行处理,很多导出工具处理了这部分的功能,结果变得臃肿和难以使用,这是有仔细考量的,希望你能理解~~
from proton.
Related Issues (13)
- string array may has ','
- 关于结构体 : 数组 , 分割的问题。 HOT 1
- value里不能包含\n(换行符)
- 是否不支持不同类型数组的嵌套定义? HOT 2
- 导出莫名奇妙的字符! HOT 1
- 怎样实现复杂的嵌套 HOT 1
- 关于导出 Json 文件格式的问题 HOT 1
- 关于导出文件输出目录的问题 HOT 3
- 生成的文件会自带's'后缀名, 参数填的是空字符串 HOT 3
- 输出Json格式化问题 HOT 1
- 请问如何能把Excel文件统一放进一个文件夹? HOT 5
- 想请教一下,能不能单独获取某个配置表信息 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proton.