我在windows(C#)应用程序中使用aspose 8.0.1.0。当我将列的公式设置为
时import os
import random
import time
def Menu():
global damage
global xp
global gold
damage = 1
xp = 0
gold = 0
print("\nyour attack value is", damage,"\nyour xp level is", xp,"\nand you have", gold,"gold.\n")
sword = input("Old Joe Smith: Do you need a sword? ")
sword = sword.lower()
if sword == "yes":
damage = damage + 9
print("Old Joe Smith: *Gives you a sharp steel sword* Good luck on your travels!\n\nYour new attack value is",damage,"\n")
time.sleep(2)
Hills()
if sword == "yeah":
damage = damage + 9
print("Old Joe Smith: *Gives you a sharp steel sword* Good luck on your travels!\n\nYour new attack value is",damage,"\n")
time.sleep(2)
Hills()
elif sword == "no":
print("Old Joe Smith: Well, if you say so... ...good luck anyway!\n")
Hills()
else:
print("Old Joe Smith: I'm sorry, what?")
time.sleep(1)
Menu()
def Hills():
print("*You walk through the forest, when out of nowhere a minotaur appears!*")
fight = input("What will you do, run or fight? ")
fight = fight.lower()
if fight == "run":
print("You escape, barely.")
Cave()
if fight == "fight":
input("Press enter")
if damage > 5:
print("You win! you looted 10 gold and got 5 xp.")
gold = gold + 10
xp = xp + 5
Cave()
elif damage < 5:
print("You died. Game over.")
Menu()
else:
print("How the hell did you get exactly 5 damage?")
Menu()
else:
print("Your lack of a proper response makes the minotaur charge. It kills you instantly.")
Menu()
def Cave():
print("You stumble into a cave. there are two routes in the cave. which way do you want to go, left or right?")
print("Welcome to 'RPG Game', a role-playing game developed in Python 3.3.\nThis game was developed by bamf_mccree.\n")
print("Old Joe Smith: Hello, adventurer, and welcome to Dankhill, in the centre of Whitewood forest. \nThis was once a peaceful place, but the evil Lord Draktha has enslaved most of the civilians of our realm.")
time.sleep(4)
Menu()
公式自动更改为
sheet1.Cells[3, 2].Formula = "='Supplies - Factor'!G757222";
我已使用调试器验证了它。如果我将公式设置为
&#34; =&#39;耗材 - 因素&#39;!G757222&#34;
然后它自动更改为
&#34; =&#39;耗材 - 因素&#39;!G36326&#34;
知道为什么会这样吗?
答案 0 :(得分:1)
请尝试最新版本/修复:Aspose.Cells for .NET v8.9.0(您可以下载它here)。请尝试将文件保存为XLSX或其他高级MS Excel文件格式(而不是旧的XLS)。我已使用以下示例代码测试了您的方案/案例,它工作正常,公式正确插入并且不会更改。 例如 示例代码:
//Instantiate a new workbook
Workbook workbook = new Workbook();
//Get the default worksheet (first worksheet)
Worksheet sheet1 = workbook.Worksheets[0];
sheet1.Name = "Supplies - Factor";
//Enter a value to the cell
sheet1.Cells["G757222"].PutValue("Testin...");
//Add the formula to the C4 cell
sheet1.Cells[3, 2].Formula = "='Supplies - Factor'!G757222";
//Save the Excel file
workbook.Save("e:\\test2\\out1formulatest1.xlsx", SaveFormat.Xlsx);
我在Aspose担任支持开发人员/传播者。